Click the link below and....Get Sparked!

Sunday, November 22, 2009

Arduino & Servo Control Using The Mouse

After the iPhone & Arduino project, I wanted to try some mechanical objects with the Arduino MEGA. This is the first test of controlling a Servo connected to the Arduino MEGA by moving the mouse.

The mouse X axis is read by a Processing Sketch and then sent to the arduino to tell the servo to rotate.

I have updated the code to include Y axis, however I only have 1 servo at the moment =P

I will post a new video once I have received more servos...

UPDATE: Here are the Processing and Arduino source codes for this project:

ServoAppArduino.pde(File Size: 755 Bytes - Downloads:

ServoAppTest1.pde(File Size: 1.31KB - Downloads:



rajarocks1438 said...

can u send me the code iam unable to get it. iam using a old ps2 mouse. i wrote a program but its not working can u send me ur code at
thanku very much

Paul D'Intino said...

Hi there, I have updated the post to include the source code for both Arduino and Processing. I have also made modifications to the code since the video to include 2 servos. Just ignore this as the code will still work with 1 motor connected.

Abdiel Hernandez said...

Thank you for sharing it with us. I have a question. Do you have to use both of the files? the ServoAppTest and the ServoAppArduino? You can only upload one program to Arduino board, then how to use both of them?

I have a feeling is a dump question but I need your help..

Anonymous said...

The ServoAppTest file is used with Processing on the computer. The ServoAppArduino is supposed to be uploaded to the Arduino. Google Processing for more information, how to install it, and how to use it.