Controlling a servo motor from a Processing program
This example shows how to use a Processing application to control a servo motor hooked up to an Arduino. You will control the movement of a servo motor by dragging a red circle left and right on your yellow computer screen.
The circuit used simply involves a servo motor connected to one of the Arduino's analog output pins. Our code assumes we are using pin 5. If you need a refresher on how to connect a servo motor to an Arduino, check out this simple example of a servo controlled from Arduino code.
The Processing code
The Arduino code