Servo motor

This invention demonstrates how to connect a continuous rotation servo motor to your ThinkerShield. Unlike a normal servo motor this motor can turn the full 360 degrees clockwise and anticlockwise. This invention will need the use of the Servo library, which should automatically be enabled when you install Arduino. If you are unsure you may check under Tools > Manage Libraries > search “Servo”. For addition information please see the Servo page of the Arduino website.

Step 1

Step 1

Connect first alligator clip to GND (ground) on your ThinkerShield and to the negative (black) wire of your servo.

Step 2

Step 2

Connect second alligator clip to external pin VCC on your ThinkerShield and to the positive (red) wire of your servo.

Step 3

Step 3

Connect third alligator clip to external pin A0 on your ThinkerShield and to the signal (white) wire of your servo.

Step 4

// include the servo library

#include <Servo.h>


// declare the servo

Servo servo;


void setup() {

 // attach the servo pin to A0

 servo.attach (A0);


}


void loop() {

 // set the speed of the servo

 // 0 = maximum counter-clockwise

 // 90 = stopped

 // 180 = maximum clockwise

 servo.write (180);


}

Add a comment