blob: 4eba5d6eb7d545d85c670699f5ec373ce5fbba88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int angle = 20;
int i = 0;
void setup() {
for(i = 1; i < 10; i++) {
Serial.begin(115200);
myservo.attach(5); // attach the servo object on to pin 9
myservo.write(angle*i); // tell servo to rotate by 20 degrees
delay(1000); // waits for a sec
}
myservo.detach();
}
void loop() {
}
|