Now that we have mouse clicks being picked up by the computer, its time to get the mouse to actually move around the screen. In order to do this, I referred to the joystick mouse tutorial below, and modified the code as necessary.
http://www.arduino.cc/en/Tutorial/JoystickMouseControl
https://github.com/slicer364/powerglove-mouse/blob/master/powerglove_joystickmouse
Now, as I wanted the mouse to be low profile, and easily retractable, I settled on the PSP-1000 joystick- the joystick from the first generation PSP game system. https://www.adafruit.com/products/444
The "joystickmousecontrol" tutorial code applied cleanly to the psp joystick.
For some reason, I found issues if I let the mouse calibrate itself indefinitely. It might have been an issue with a short somewhere, but if I had let it calibrate too long, the mouse would eventually be pulled to the top left of the screen. In any case, stopping calibration after 5 seconds solved that issue. Calibration is listed in the tutorial's code as "borderdetect".
if (millis() > 5000){
/* after 5 seconds, do not allow any more border detection (mouse calibration)
*/
borderdetect=false;
}
-------------------------------
Let's add a way to hold the joystick to the glove.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.