-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharm.ino
42 lines (34 loc) · 796 Bytes
/
arm.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
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver srituhobby = Adafruit_PWMServoDriver();
// #define servoMIN 150
// #define servoMAX 600
void setup()
{
srituhobby.setPWM(0, 0, 400);
srituhobby.setPWM(1, 0, 400);
srituhobby.setPWM(2, 0, 200);
srituhobby.setPWM(4, 0, 5);
Serial.begin(9600);
srituhobby.begin();
srituhobby.setPWMFreq(60);
}
int mov(int servo, int start, int stop1)
{
servo = servo;
start = start;
stop1 = stop1;
srituhobby.setPWM(servo, 0, start);
Serial.println(servo);
delay(50);
for(int i=start;i<stop1;i+=5){
srituhobby.setPWM(servo, 0, i);
Serial.println(servo);
delay(50);
}
}
void loop(){
mov (1, 300, 600);
mov (2, 150, 200);
mov (4, 90, 500);
}