concept:
Function A (input) performed by an arduino uno connected through USB and acting as a keyboard.Other function B C D actions performed by the same java programme as in first implementation.
Image of hardware setup: Arduino wwith switches, USB link,
Story
In this implementation, we try to separate the input device from the device finally being controlled and performing the actions. Arduino uno is fitted with 5 inputs. To start with these inputs are switches. These switches are treated exactly as the keyboard keys in the first implementation.the switch pressed is considered as the 'keydown' event.
Arduino sends the USB code representing a combination of keys pressed ( max 6 keys can be pressed simultaneously together).
On the host side, the program still listens to key pressed and builds the "words" according to the rhythm at which the switches are pressed.
Arduino code
Specific trick to have Arduino Uno seen as a keyboard by a computer
Some Arduinos allow the use of library xxxx that will make the Arduino to send commands recognised as standard Human Input Device (in this case a keyboard)Arduino Uno does not support such library.
A way around consists in changing the firmware of the Arduino to a firmware that mimics a keyboard.
Code implementation needs to be done using the standard Arduion firmware. Running the code is done using a "keyboard firmware"
link to page explaining how to
Tried on following platforms : macbook with osx, ...
Alternative input sensors
Alternatively to the switches, microphones were also used. Input is detected when the user taps on the microphone and the value returned by the microphone is the max value.Hardware
microphone board
Software
Whenever a max value is detected on the output of the mic sensor, the input is digitalized and a variable is set at "1" for a period of time. The input is detected by a loop looking for changes from 0 to 1 in this variabl ( on rising edge).
Arduino code
Alternative input sensors to be tested
light switcheslight beams
piezo sensors
capacitive sensors
others ...
Comments
Post a Comment