n this project we will make Servo Motor Control with an Arduino. I will use arduino uno in the circuit design program. I use usually arduino mega 2560. You can use the other arduino cards. Good Luck.
Schema:
Materials:
Arduino UNO / Other Arduino Cards x 1
Servo Motor x 5
Jumper Cable
Program:
// letsarduino.com
// [Project 9] - Servo Motor Control with an Arduino
#include<Servo.h>
Servo myservo;
int pos = 0; // starting position of servo
void setup()
{
myservo.attach(8); // Servo signal pin
}
void loop()
{
for(pos = 0; pos < 180; pos += 1) // from 0 to 1 position turn 180 degree
{
myservo.write(pos);
delay(10);
}
for(pos = 180; pos>=1; pos-=1) // from 1 to 0 position turn 180 degree
{
myservo.write(pos);
delay(10);
}
}
Servo Motor Pins:
Project Related Images:
Không có nhận xét nào:
Đăng nhận xét