Micro Servo Motor
Interface Micro Servo Motor with Arduino
Arduino Sketch :
#include <Servo.h>
Servo myservo;
void setup()
{
myservo.attach(11);
myservo.write(0);
delay(1000);
}
void loop()
{
myservo.write(15);
delay(1000);
myservo.write(180);
delay(1000);
myservo.write(45);
delay(1000);
myservo.write(60);
delay(1000);
myservo.write(75);
delay(1000);
myservo.write(90);
delay(1000);
myservo.write(75);
delay(1000);
myservo.write(60);
delay(1000);
myservo.write(45);
delay(1000);
myservo.write(30);
delay(1000);
myservo.write(180);
delay(1000);
myservo.write(0);
delay(1000);
for(int num=0;num<=180;num++)
{
myservo.write(num);
delay(10);
}
for(int num=180;num>=90;num--)
{
myservo.write(num);
delay(10);
}
delay(5000);
}
Thank you.
0 Comments