Servo Components Step Motor

 

 

 

 

 

I’ve just received my Bluetooth Controlled Robot Car Kit and it has a micro servo that needs testing (and I’ve never worked with one before).

From the reference page of Arduino site, a Servo is:

“Servos have integrated gears and a shaft that can be precisely controlled. Standard servos allow  the shaft to be positioned at various angles, usually between 0 and 180 degrees. Continuous rotation servos allow the rotation of the shaft to be set to various speeds.”

The Servos have three wires, – Power, ground and signal – This one has a brown (ground), red(power) and orange(ish) that’s the signal.

For the example (in the Arduino IDE), connect the wires to Ground, VCC and PIN9 of the Arduino

From the Arduino IDE examples, this is the code:

// Sweep
// by BARRAGAN <http://barraganstudio.com> 
// This example code is in the public domain.
#include <Servo.h> 

Servo myservo; // create servo object to control a servo 
 // a maximum of eight servo objects can be created 

int pos = 0; // variable to store the servo position 

void setup() 
{ 
 myservo.attach(9); // attaches the servo on pin 9 to the servo object 
} 

void loop() 
{ 
 for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees 
 { // in steps of 1 degree 
 myservo.write(pos); // tell servo to go to position in variable 'pos' 
 delay(15); // waits 15ms for the servo to reach the position 
 } 
 for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees 
 { 
 myservo.write(pos); // tell servo to go to position in variable 'pos' 
 delay(15); // waits 15ms for the servo to reach the position 
 } 
}