-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathE_SERVO.ino
50 lines (45 loc) · 984 Bytes
/
E_SERVO.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <Servo.h>
Servo e_servo1;
Servo e_servo2;
Servo e_servo3;
void setup() {
e_servo1.attach(11);//OC1A
e_servo2.attach(12);//OC1B
e_servo3.attach(13);//OC1C,OC0A
}
void loop()
{
//Servo 1
for (pos = 0; pos <= 180; pos += 1)
{
e_servo1.write(pos);
delay(15);
}
for (pos = 180; pos >= 0; pos -= 1)
{
e_servo1.write(pos);
delay(15);
}
//Servo 2
for (pos = 0; pos <= 180; pos += 1)
{
e_servo2.write(pos);
delay(15);
}
for (pos = 180; pos >= 0; pos -= 1)
{
e_servo2.write(pos);
delay(15);
}
//Servo 3
for (pos = 0; pos <= 180; pos += 1)
{
e_servo3.write(pos);
delay(15);
}
for (pos = 180; pos >= 0; pos -= 1)
{
e_servo3.write(pos);
delay(15);
}
}