Welcome to my first Instructable. I recently began tinkering with my new Arduino Uno and decided to find an application for a PS2 joystick module. I thought it would be nifty to turn my Arduino into a joystick controlled mouse for my PC.
Who needs a joystick when you can use your mouse as a joystick. This article will help you in using mouse as joystick. The computer mouse has a specific utility. It is used to displace the cursor so that it may glide over your screen over files and programs.
I must confess: I thought the task would be easy using the 'mouse' library I found online, little did I realize that this class only works with Arduino Leonard and Micro (and perhaps a few others), but not the ubiquitous Uno. I was discouraged, but I decided to use the Uno's serial communication as well as my rudimentary Java abilities to 'hack' the Uno into a functional mouse for Windows. It surprisingly worked! The setup of the Uno can be seen in the materials picture, and here's the instructions: Connect the five female to female wires to the pins of the joystick module.
Now, connect five male to male wires into the ends of the female wires and connect them to the Arduino in this way: 1. The Ground on the joystick to Arduino Gnd 2. The +5V on the joystick to Arduino 5V 3.
The UPx on the joystick to A0 on the Arduino 4. The UPy on the joystick to A1 5. The SW pin (the digital click switch) to digital pin 7 on the Arduino. I hope this project works for you and that you can improve upon it.
Ultimately, the easiest solution is to use an Arduino Leonard or Mini that can function as a system device for mouse inputs, but I found it fun to make the Uno function in a way it was not designed--a mouse--by using my limited Java knowledge. I learned a lot alone the way and hope to add several features in the future: -Right Click button. The joystick has one button which I reserved for the left click.
-Real device driver for this project. I'm not sure if this is possible, maybe someone can enlighten me on the subject! Thanks for reading! I had the same problem, here's what I did to make it work. I am on MacOS. I think the reason is because BlueJ is unable to find the two Java library files required for the code to work, 'RXTXcomm.jar' and 'librxtxSerial.jnilib'. You can get the 2 files from (I downloaded binary 'rxtx 2.2pre2 (prerelease)' because I was faced with RXTXcom files mismatched, which requires both your Arduino and Java IDE (BlueJ) having the same version (2.2) of RXTX.
Now, you have to move the 2 files into your Java directory (which is hidden by default, can be open with Terminal by the following code). Cd /Library/Java/ open. Move the 2 files into the Extension folder. (Admin password will be required) Next, make sure you have directed BlueJ towards 2 libraries, RXTXcom.jar (which is the one you just installed in the Java directory) and the (from the tutorial above). You do so by -> BlueJ -> Preferences -> Library -> add files.
Now BlueJ should know where to find those correct 2 libraries for the code to work. Restart BlueJ, compile the code, and right click on the 'mouse' module -> void main (string[] args) -> 'OK'. It should work by now. (took me 8 hours to figure this all out!) Now, i'm off to try to make this work on Processing. Hi, it doesn't work in eclipse ide. Will you help me?