SERVO Motor Testing
MATERIALS REQUIRED:
Arduino Board
Servo Motor
Jumper wires
CIRCUIT:
Servo motors have three wires: power, ground, and signal. So in the servo motor wire first insert male to male jumper wire and then connect yellow wire to pin 6 in arduino board, black wire to GND, red wire to 5v or breadboard is used here.
CODE:
#include <Servo.h>
Servo servo1;
int servoPin = 9;
void setup(){
servo1.attach(servoPin);
}
void loop(){
servo1.writeMicroseconds(1000);
delay(1000);
servo1.writeMicroseconds(1500);
delay(1000);
servo1.writeMicroseconds(2000);
delay(1000);
}
NOTE: Check the voltage when you are using a breadboard it should be 5v.
Comments
Post a Comment