-
Notifications
You must be signed in to change notification settings - Fork 0
/
Servosstickchart.pde
executable file
·66 lines (48 loc) · 1.06 KB
/
Servosstickchart.pde
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
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "Tlc5940.h"
#include "tlc_servos.h"
#define SERVO_CHANNEL1 1
#define SERVO_CHANNEL3 3
#define SERVO_CHANNEL4 4
#define SERVO_CHANNEL5 5
#define SERVO_CHANNEL6 6
#define SERVO_CHANNEL7 7
#define SERVO_CHANNEL8 8
#define SERVO_CHANNEL9 9
#define SERVO_CHANNEL10 10
#define SERVO_CHANNEL11 11
#define SERVO_CHANNEL12 12
#define SERVO_CHANNEL13 13
int angle1;
int angle2;
int angle3;
#define DELAY_TIME 20
char place[] = "0000000";
byte incomingData;
void setup()
{
tlc_initServos(); // Note: this will drop the PWM freqency down to 50Hz.
`Serial.begin(9600);
}
void loop()
{
if(Serial.available(){
incomingData= Serial.read();
}
while (Serial.available()>0) {
for (int i=0; i<10; i++) {
buff[i]=buff[i+1];
}
buff[i]=Serial.read();
if (buff[0]=='n') {
angle1=int(buff[1]);
}
if (buff[10]=='g') {
angle2=int(buff[9]);
}
if (buff[10]=='o') {
angle3=int(buff[9]);
}
tlc_setServo(SERVO_CHANNEL, angle);
Tlc.update();
delay(DELAY_TIME);
}