-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathServoController.c
52 lines (41 loc) · 1.79 KB
/
ServoController.c
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
51
52
#include "ServoController.h"
//.54 drawed amps were measured for a standard servo, 5.04 volts draw were measured, .28 volts for the signal.
void testServo(int pin){
rotateLeft(pin);
rotateRight(pin);
rotateCenter(pin);
servo_stop();
}
void rotateLeft(int pin){
int lastPulse = servo_get(pin);
print("The last pulse was: %d\n", lastPulse);
int disableStatus = servo_disable(pin);
print("The servo disable status is:%d\n", disableStatus);
print("Testing servo on pin %d\n", pin);
servo_angle(pin, 1800); // P16 servo to 0 degrees
pause(1000); // ...for 3 seconds
int lastPulseTwo = servo_get(pin);
print("The last pulse was: %d\n", lastPulseTwo);
}
void rotateRight(int pin){
int lastPulse = servo_get(pin);
print("The last pulse was: %d\n", lastPulse);
int disableStatus = servo_disable(pin);
print("The servo disable status is:%d\n", disableStatus);
print("Testing servo on pin %d\n", pin);
servo_angle(pin, 400); // P16 servo to 0 degrees
pause(1000); // ...for 3 seconds
int lastPulseTwo = servo_get(pin);
print("The last pulse was: %d\n", lastPulseTwo);
}
void rotateCenter(int pin){
int lastPulse = servo_get(pin);
print("The last pulse was: %d\n", lastPulse);
int disableStatus = servo_disable(pin);
print("The servo disable status is:%d\n", disableStatus);
print("Testing servo on pin %d\n", pin);
servo_angle(pin, 900); // P16 servo to 0 degrees
pause(1000); // ...for 3 seconds
int lastPulseTwo = servo_get(pin);
print("The last pulse was: %d\n", lastPulseTwo);
}