-
Notifications
You must be signed in to change notification settings - Fork 1
/
biest2.ino
189 lines (143 loc) · 2.97 KB
/
biest2.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
//Legs UP and Down
#define FL 11 // Front Left
#define BL 9 // Back Left
#define ML 10 // Middle Left
#define FR 6 // Front Right
#define BR 4 // Back Right
#define MR 5 // Middle Right
//Legs Movement
#define MFL 12 // Move Front Left
#define MBL 14 // Move Back Left
#define MML 13 // Move Middle Left
#define MFR 17 // Move Front Right
#define MBR 16 // Move Back Right
#define MMR 15 // Move Middle Right
//Head
#define HT 8 // Tilt
#define HR 2 // Pan Right
#define HL 3 // Pan Right
// Tail
#define TL 7 // Tail UP
void setup() {
pinMode(FL, OUTPUT);
pinMode(BL, OUTPUT);
pinMode(ML, OUTPUT);
pinMode(FR, OUTPUT);
pinMode(BR, OUTPUT);
pinMode(MR, OUTPUT);
pinMode(MFL, OUTPUT);
pinMode(MBL, OUTPUT);
pinMode(MML, OUTPUT);
pinMode(MFR, OUTPUT);
pinMode(MBR, OUTPUT);
pinMode(MMR, OUTPUT);
pinMode(HT, OUTPUT);
pinMode(HR, OUTPUT);
pinMode(HL, OUTPUT);
pinMode(TL, OUTPUT);
}
void look_around() {
digitalWrite(HT, HIGH);
delay(500);
digitalWrite(HR, HIGH);
digitalWrite(TL, HIGH);
delay(500);
digitalWrite(HL, HIGH);
delay(500);
digitalWrite(HT, LOW);
delay(500);
digitalWrite(HR,LOW);
digitalWrite(TL,LOW);
delay(500);
digitalWrite(HL,LOW);
delay(1000);
}
void tap_dance(int dly) {
digitalWrite(FL, HIGH);
delay(dly);
digitalWrite(FL, LOW);
delay(dly);
digitalWrite(ML, HIGH);
delay(dly);
digitalWrite(ML, LOW);
delay(dly);
digitalWrite(BL, HIGH);
delay(dly);
digitalWrite(BL, LOW);
delay(dly);
digitalWrite(BR, HIGH);
delay(dly);
digitalWrite(BR, LOW);
delay(dly);
digitalWrite(MR, HIGH);
delay(dly);
digitalWrite(MR, LOW);
delay(dly);
digitalWrite(FR, HIGH);
delay(dly);
digitalWrite(FR, LOW);
delay(dly);
}
void move_fwd() {
digitalWrite(FR, HIGH);
delay(100);
digitalWrite(MFR, LOW);
delay(500);
digitalWrite(FR, LOW);
delay(500);
digitalWrite(FL, HIGH);
delay(100);
digitalWrite(MFL, LOW);
delay(500);
digitalWrite(FL, LOW);
delay(500);
digitalWrite(MR, HIGH);
delay(100);
digitalWrite(MMR, LOW);
delay(500);
digitalWrite(MR, LOW);
delay(500);
digitalWrite(ML, HIGH);
delay(100);
digitalWrite(MML, LOW);
delay(500);
digitalWrite(ML, LOW);
delay(500);
digitalWrite(BR, HIGH);
delay(100);
digitalWrite(MBR, LOW);
delay(500);
digitalWrite(BR, LOW);
delay(500);
digitalWrite(BL, HIGH);
delay(100);
digitalWrite(MBL, LOW);
delay(500);
digitalWrite(BL, LOW);
delay(500);
digitalWrite(MFR, HIGH);
digitalWrite(MMR, HIGH);
digitalWrite(MBR, HIGH);
digitalWrite(MFL, HIGH);
digitalWrite(MML, HIGH);
digitalWrite(MBL, HIGH);
delay(1000);
}
void loop() {
look_around();
//head up, middle pos
digitalWrite(HT, HIGH);
delay(500);
digitalWrite(HR, HIGH);
for (int a=0;a<=5;a++) {
move_fwd();
}
//tail up
digitalWrite(TL, HIGH);
//wait 15 Sek
delay(15000);
//tail down
digitalWrite(TL, LOW);
//wait 5 Sek
delay(5000);
}