I had this idea after seeing this video from seeedstudio where they play pacman on a led matrix using gestures.
For the Arduino sketch I edited the paj7620_15gesture example from seeedstudio's library.
When a gesture is detected, it sends a number from 1 to 15 on the serial port.
Change these two values according to your circumstance
#define GES_REACTION_TIME 600
#define GES_QUIT_TIME 1000
GES_QUIT_TIME is the delay between to gestures, and GES_REACTION_TIME is the maximum length of a continous gesture in milliseconds.
On the computer side there is a program that listen to the incomming data on the serial port.
I used jssc library for serial communication in Java.
Once it receive a number on the serial port it executes an action, that can be to press a key on the keyboard or a button on the mouse.
In the github repository, you can find the exported jar file of the program Jesty.jar.
When you run the program for the first time you will see all the gesture disabled, with no action associated.
If you want to associate an action to a gesture, press the button near it. Now just tipe a key or press a mouse button.
All keys are valid except for Esc key. Pressing Esc key will cancel the operation.
To enable a gesture, click on its checkbox.
Now select the serial port from the dropdown and press START button.
If the program is properly listening on the serial port, the button's label will change to "STOP".
To make a quick test, associate some keys to some gesture, open a text editor and should see character appear each time you do make the associated gesture.
You can edit actions enable/disable gestures even if the program is already listening on the serial port.
When you close the program all the setups are stored in a file data.json in the same folder as Jesty.jar.
At the next run, you will find your previous configuration.
Comments