Hey guys. I'm very new to this and forgive me if this is a repost, I tried searching for it. I am trying to get the Arduino to show X and Y coordinates from a USB(or PS2) mouse connected to it on the serial monitor. I've tried the PS2 mouse example and even updated the library with no luck. I even searched for a few project people were nice enough to share and had no luck. The closest I got was a OptiMouse Coordinates sketch that would show X and Y values but they would just increase endlessly and not follow the mouse's coordinates. Please help me out and be merciful. Thanks everyone in advance!
Is this how you wired and programmed it?
http://playground.arduino.cc/componentLib/Ps2mouse
If not, please provide
- the source code link OR if you changed ANYTHING, the entire code
- details on your connections, high-resolution pix are nice
Ray
Thank you for the reply. Yes that is among the code I have tried. I have used the exact code from the example. I have the Power and Ground wired to the arduino's 5v and ground. The clock is connected to pin 6 while data is connected to pin 5. I've tried this code with both the Uno and Leonardo.
If possible, Could anyone please post some working PS2 mouse code and a link for the library? I've already tried the PS2 Mouse example and "unpacked into arduino/libraries. And in ps2.h replace[d] "WProgram.h" with "Arduino.h". Everytime I check the serial monitor with this code and wiring all I get is a blank page. Thanks in advance.
The closest I got was a OptiMouse Coordinates sketch that would show X and Y values but they would just increase endlessly and not follow the mouse's coordinates
There are no mouse coordnates, the signals are differential. I thnk you are interpreting them wrong.
Thanks for the reply Grumpy_Mike. How would I have the arduino take signal from the mouse and display it on the serial monitor?
Does this not work? With the examples?
I haven't got a mouse so I can't tell.
Everytime I check the serial monitor with this code and wiring all I get is a blank page.
So do some debug serial prints and see what is happening.
ps2.zip (76.2 KB)
The example code did not seem to work. I added some random serial prints to see if it would print to the monitor. The random prints would show up but it will not show any mouse information. Thank you again.
That makes me suspect that you are not using a compatible mouse, or that it is not connected to the Arduino correctly.
Hey, I've connected Clock to 6 and Data to 5. I have even tried different pin combinations, As for mouse compatibility, I have tried 3 different mice around the office. One PS2 ball mouse, PS2 Laser mouse, and USB laser mouse. All of the mice are different brands. After doing some trouble shooting it seems that the arduino freezes up at "void mouse_init()" after commenting everything related to mouse_init I was able to get one of my random serial prints to work. I still do not get any x or y information though. Please help if you can.
your mouse is probabaly not connected properly