Servo Motor

The code for the servo motor.


#include <Servo.h>
Servo servoRight; // Define right servo

int angle = 0; // servo position in degrees
void setup() {

servoRight.attach(9); // Set right servo to digital pin 9


void loop() { // Loop through motion tests

delay (1500); // Example: move forward

delay (1500); // Example: move forward

// Motion routines for forward, reverse, turns, and stop
void forward() {


void reverse() {


Setting up a servo is extremely easy. The red cable is for power, black for ground and white for signal. An easy setup for servo’s is 5v into the breadboard, power and ground go into the relevant pins and signal will go into a digital output say pin 9.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>