Revision 1388
Completed iterative test of functions in lights.h (aka LIGHT SHOW!)
Currently using orb_n_set and orb_n_set_color with indexing from 1. This breaks orb_n_set and orb_n_set_color as they are set to index from 0.
Need to document this using Doxygen
trunk/code/projects/test/test_lights.c | ||
---|---|---|
1 | 1 |
#include <dragonfly_lib.h> |
2 | 2 |
|
3 |
int testlights(void) { |
|
4 |
//usb_init(); |
|
3 |
|
|
4 |
|
|
5 |
int test_lights(void) { |
|
6 |
int i=0; |
|
7 |
|
|
8 |
//usb_init(); |
|
5 | 9 |
usb_puts("usb turned on\n"); |
6 |
delay_ms(1000); |
|
10 |
delay_ms(1000); |
|
11 |
|
|
12 |
/** Test RGB color setting (both orbs) **/ |
|
13 |
for(i=0;i<256;i++){ |
|
14 |
orb_set(i,0,0); |
|
15 |
delay_ms(10); |
|
16 |
} |
|
17 |
for(i=0;i<256;i++){ |
|
18 |
orb_set(0,i,0); |
|
19 |
delay_ms(10); |
|
20 |
} |
|
21 |
for(i=0;i<256;i++){ |
|
22 |
orb_set(0,0,i); |
|
23 |
delay_ms(10); |
|
24 |
} |
|
25 |
|
|
26 |
/** Test RBG color, two parameters with changing parameters (both orbs) **/ |
|
27 |
for(i=0;i<256;i++){ |
|
28 |
orb_set(i,i,0); |
|
29 |
delay_ms(10); |
|
30 |
} |
|
31 |
for(i=0;i<256;i++){ |
|
32 |
orb_set(0,i,i); |
|
33 |
delay_ms(10); |
|
34 |
} |
|
35 |
for(i=0;i<256;i++){ |
|
36 |
orb_set(i,0,i); |
|
37 |
delay_ms(10); |
|
38 |
} |
|
39 |
|
|
40 |
/** Test RBG color, all parameters with changing parameters (both orbs) **/ |
|
41 |
for(i=0;i<256;i++){ |
|
42 |
orb_set(i,i,i); |
|
43 |
delay_ms(10); |
|
44 |
} |
|
45 |
|
|
46 |
/** Test RGB color setting (orb1) **/ |
|
47 |
for(i=0;i<256;i++){ |
|
48 |
orb1_set(i,0,0); |
|
49 |
delay_ms(10); |
|
50 |
} |
|
51 |
for(i=0;i<256;i++){ |
|
52 |
orb1_set(0,i,0); |
|
53 |
delay_ms(10); |
|
54 |
} |
|
55 |
for(i=0;i<256;i++){ |
|
56 |
orb1_set(0,0,i); |
|
57 |
delay_ms(10); |
|
58 |
} |
|
59 |
|
|
60 |
/** Test RBG color, two parameters with changing parameters (orb1) **/ |
|
61 |
for(i=0;i<256;i++){ |
|
62 |
orb1_set(i,i,0); |
|
63 |
delay_ms(10); |
|
64 |
} |
|
65 |
for(i=0;i<256;i++){ |
|
66 |
orb1_set(0,i,i); |
|
67 |
delay_ms(10); |
|
68 |
} |
|
69 |
for(i=0;i<256;i++){ |
|
70 |
orb1_set(i,0,i); |
|
71 |
delay_ms(10); |
|
72 |
} |
|
73 |
|
|
74 |
/** Test RBG color, all parameters with changing parameters (orb1) **/ |
|
75 |
for(i=0;i<256;i++){ |
|
76 |
orb1_set(i,i,i); |
|
77 |
delay_ms(10); |
|
78 |
} |
|
7 | 79 |
|
8 |
orb_set_color(RED); |
|
80 |
/** Test RGB color setting (orb2) **/ |
|
81 |
for(i=0;i<256;i++){ |
|
82 |
orb2_set(i,0,0); |
|
83 |
delay_ms(10); |
|
84 |
} |
|
85 |
for(i=0;i<256;i++){ |
|
86 |
orb2_set(0,i,0); |
|
87 |
delay_ms(10); |
|
88 |
} |
|
89 |
for(i=0;i<256;i++){ |
|
90 |
orb2_set(0,0,i); |
|
91 |
delay_ms(10); |
|
92 |
} |
|
93 |
|
|
94 |
/** Test RBG color, two parameters with changing parameters (orb2) **/ |
|
95 |
for(i=0;i<256;i++){ |
|
96 |
orb2_set(i,i,0); |
|
97 |
delay_ms(10); |
|
98 |
} |
|
99 |
for(i=0;i<256;i++){ |
|
100 |
orb2_set(0,i,i); |
|
101 |
delay_ms(10); |
|
102 |
} |
|
103 |
for(i=0;i<256;i++){ |
|
104 |
orb2_set(i,0,i); |
|
105 |
delay_ms(10); |
|
106 |
} |
|
107 |
|
|
108 |
/** Test RBG color, all parameters with changing parameters (orb2) **/ |
|
109 |
for(i=0;i<256;i++){ |
|
110 |
orb2_set(i,i,i); |
|
111 |
delay_ms(10); |
|
112 |
} |
|
113 |
|
|
114 |
/** Test RGB color setting (n=1) **/ |
|
115 |
for(i=0;i<256;i++){ |
|
116 |
orb_n_set(1,i,0,0); |
|
117 |
delay_ms(10); |
|
118 |
} |
|
119 |
for(i=0;i<256;i++){ |
|
120 |
orb_n_set(1,0,i,0); |
|
121 |
delay_ms(10); |
|
122 |
} |
|
123 |
for(i=0;i<256;i++){ |
|
124 |
orb_n_set(1,0,0,i); |
|
125 |
delay_ms(10); |
|
126 |
} |
|
127 |
|
|
128 |
/** Test RBG color, two parameters with two changing parameters (n=1) **/ |
|
129 |
for(i=0;i<256;i++){ |
|
130 |
orb_n_set(1,i,i,0); |
|
131 |
delay_ms(10); |
|
132 |
} |
|
133 |
for(i=0;i<256;i++){ |
|
134 |
orb_n_set(1,0,i,i); |
|
135 |
delay_ms(10); |
|
136 |
} |
|
137 |
for(i=0;i<256;i++){ |
|
138 |
orb_n_set(1,i,0,i); |
|
139 |
delay_ms(10); |
|
140 |
} |
|
141 |
|
|
142 |
/** Test RBG color, all parameters with two changing parameters (n=1) **/ |
|
143 |
for(i=0;i<256;i++){ |
|
144 |
orb_n_set(1,i,i,i); |
|
145 |
delay_ms(10); |
|
146 |
} |
|
147 |
|
|
148 |
/** Test RGB color setting (n=2) **/ |
|
149 |
for(i=0;i<256;i++){ |
|
150 |
orb_n_set(2,i,0,0); |
|
151 |
delay_ms(10); |
|
152 |
} |
|
153 |
for(i=0;i<256;i++){ |
|
154 |
orb_n_set(2,0,i,0); |
|
155 |
delay_ms(10); |
|
156 |
} |
|
157 |
for(i=0;i<256;i++){ |
|
158 |
orb_n_set(2,0,0,i); |
|
159 |
delay_ms(10); |
|
160 |
} |
|
161 |
|
|
162 |
/** Test RBG color, two parameters with two changing parameters (n=2) **/ |
|
163 |
for(i=0;i<256;i++){ |
|
164 |
orb_n_set(2,i,i,0); |
|
165 |
delay_ms(10); |
|
166 |
} |
|
167 |
for(i=0;i<256;i++){ |
|
168 |
orb_n_set(2,0,i,i); |
|
169 |
delay_ms(10); |
|
170 |
} |
|
171 |
for(i=0;i<256;i++){ |
|
172 |
orb_n_set(2,i,0,i); |
|
173 |
delay_ms(10); |
|
174 |
} |
|
175 |
|
|
176 |
/** Test RBG color, all parameters with two changing parameters (n=2) **/ |
|
177 |
for(i=0;i<256;i++){ |
|
178 |
orb_n_set(2,i,i,i); |
|
179 |
delay_ms(10); |
|
180 |
} |
|
181 |
|
|
182 |
/** Weird not even RGB color test for both orbs **/ |
|
183 |
for(i=2;i<256;i++){ |
|
184 |
orbs_set (i,i-1,i-2,i-2,i-1,i); |
|
185 |
delay_ms(10); |
|
186 |
} |
|
187 |
|
|
188 |
/** Test all #define'd colors (both orbs) **/ |
|
189 |
orb_set_color(ORB_OFF); |
|
9 | 190 |
delay_ms(1000); |
191 |
orb_set_color(RED); |
|
192 |
delay_ms(1000); |
|
10 | 193 |
orb_set_color(ORANGE); |
11 | 194 |
delay_ms(1000); |
12 | 195 |
orb_set_color(YELLOW); |
13 | 196 |
delay_ms(1000); |
197 |
orb_set_color(LIME); |
|
198 |
delay_ms(1000); |
|
14 | 199 |
orb_set_color(GREEN); |
15 | 200 |
delay_ms(1000); |
201 |
orb_set_color(CYAN); |
|
202 |
delay_ms(1000); |
|
16 | 203 |
orb_set_color(BLUE); |
17 | 204 |
delay_ms(1000); |
205 |
orb_set_color(PINK); |
|
206 |
delay_ms(1000); |
|
18 | 207 |
orb_set_color(PURPLE); |
19 | 208 |
delay_ms(1000); |
209 |
orb_set_color(MAGENTA); |
|
210 |
delay_ms(1000); |
|
211 |
orb_set_color(WHITE); |
|
212 |
delay_ms(1000); |
|
213 |
orb_set_color(ORB_OFF); |
|
214 |
delay_ms(1000); |
|
215 |
|
|
216 |
/** Test all #define'd colors (orb1) **/ |
|
217 |
orb1_set_color(ORB_OFF); |
|
218 |
delay_ms(1000); |
|
219 |
orb1_set_color(RED); |
|
220 |
delay_ms(1000); |
|
221 |
orb1_set_color(ORANGE); |
|
222 |
delay_ms(1000); |
|
223 |
orb1_set_color(YELLOW); |
|
224 |
delay_ms(1000); |
|
225 |
orb1_set_color(LIME); |
|
226 |
delay_ms(1000); |
|
227 |
orb1_set_color(GREEN); |
|
228 |
delay_ms(1000); |
|
229 |
orb1_set_color(CYAN); |
|
230 |
delay_ms(1000); |
|
231 |
orb1_set_color(BLUE); |
|
232 |
delay_ms(1000); |
|
233 |
orb1_set_color(PINK); |
|
234 |
delay_ms(1000); |
|
235 |
orb1_set_color(PURPLE); |
|
236 |
delay_ms(1000); |
|
237 |
orb1_set_color(MAGENTA); |
|
238 |
delay_ms(1000); |
|
239 |
orb1_set_color(WHITE); |
|
240 |
delay_ms(1000); |
|
241 |
orb1_set_color(ORB_OFF); |
|
242 |
delay_ms(1000); |
|
20 | 243 |
|
244 |
/** Test all #define'd colors (orb2) **/ |
|
245 |
orb2_set_color(ORB_OFF); |
|
246 |
delay_ms(1000); |
|
247 |
orb2_set_color(RED); |
|
248 |
delay_ms(1000); |
|
249 |
orb2_set_color(ORANGE); |
|
250 |
delay_ms(1000); |
|
251 |
orb2_set_color(YELLOW); |
|
252 |
delay_ms(1000); |
|
253 |
orb2_set_color(LIME); |
|
254 |
delay_ms(1000); |
|
255 |
orb2_set_color(GREEN); |
|
256 |
delay_ms(1000); |
|
257 |
orb2_set_color(CYAN); |
|
258 |
delay_ms(1000); |
|
259 |
orb2_set_color(BLUE); |
|
260 |
delay_ms(1000); |
|
261 |
orb2_set_color(PINK); |
|
262 |
delay_ms(1000); |
|
263 |
orb2_set_color(PURPLE); |
|
264 |
delay_ms(1000); |
|
265 |
orb2_set_color(MAGENTA); |
|
266 |
delay_ms(1000); |
|
267 |
orb2_set_color(WHITE); |
|
268 |
delay_ms(1000); |
|
269 |
orb2_set_color(ORB_OFF); |
|
270 |
delay_ms(1000); |
|
271 |
|
|
272 |
/** Test all #define'd colors (n=1) **/ |
|
273 |
orb_n_set_color(1,ORB_OFF); |
|
274 |
delay_ms(1000); |
|
275 |
orb_n_set_color(1,RED); |
|
276 |
delay_ms(1000); |
|
277 |
orb_n_set_color(1,ORANGE); |
|
278 |
delay_ms(1000); |
|
279 |
orb_n_set_color(1,YELLOW); |
|
280 |
delay_ms(1000); |
|
281 |
orb_n_set_color(1,LIME); |
|
282 |
delay_ms(1000); |
|
283 |
orb_n_set_color(1,GREEN); |
|
284 |
delay_ms(1000); |
|
285 |
orb_n_set_color(1,CYAN); |
|
286 |
delay_ms(1000); |
|
287 |
orb_n_set_color(1,BLUE); |
|
288 |
delay_ms(1000); |
|
289 |
orb_n_set_color(1,PINK); |
|
290 |
delay_ms(1000); |
|
291 |
orb_n_set_color(1,PURPLE); |
|
292 |
delay_ms(1000); |
|
293 |
orb_n_set_color(1,MAGENTA); |
|
294 |
delay_ms(1000); |
|
295 |
orb_n_set_color(1,WHITE); |
|
296 |
delay_ms(1000); |
|
297 |
orb_n_set_color(1,ORB_OFF); |
|
298 |
delay_ms(1000); |
|
299 |
|
|
300 |
/** Test all #define'd colors (n=2) **/ |
|
301 |
orb_n_set_color(2,ORB_OFF); |
|
302 |
delay_ms(1000); |
|
303 |
orb_n_set_color(2,RED); |
|
304 |
delay_ms(1000); |
|
305 |
orb_n_set_color(2,ORANGE); |
|
306 |
delay_ms(1000); |
|
307 |
orb_n_set_color(2,YELLOW); |
|
308 |
delay_ms(1000); |
|
309 |
orb_n_set_color(2,LIME); |
|
310 |
delay_ms(1000); |
|
311 |
orb_n_set_color(2,GREEN); |
|
312 |
delay_ms(1000); |
|
313 |
orb_n_set_color(2,CYAN); |
|
314 |
delay_ms(1000); |
|
315 |
orb_n_set_color(2,BLUE); |
|
316 |
delay_ms(1000); |
|
317 |
orb_n_set_color(2,PINK); |
|
318 |
delay_ms(1000); |
|
319 |
orb_n_set_color(2,PURPLE); |
|
320 |
delay_ms(1000); |
|
321 |
orb_n_set_color(2,MAGENTA); |
|
322 |
delay_ms(1000); |
|
323 |
orb_n_set_color(2,WHITE); |
|
324 |
delay_ms(1000); |
|
325 |
orb_n_set_color(2,ORB_OFF); |
|
326 |
delay_ms(1000); |
|
327 |
|
|
328 |
/** Test all #define'd colors (both orbs) **/ |
|
329 |
orbs_set_color(ORB_OFF,ORB_OFF); |
|
330 |
delay_ms(1000); |
|
331 |
orbs_set_color(RED,RED); |
|
332 |
delay_ms(1000); |
|
333 |
orbs_set_color(ORANGE,ORANGE); |
|
334 |
delay_ms(1000); |
|
335 |
orbs_set_color(YELLOW,YELLOW); |
|
336 |
delay_ms(1000); |
|
337 |
orbs_set_color(LIME,LIME); |
|
338 |
delay_ms(1000); |
|
339 |
orbs_set_color(GREEN,GREEN); |
|
340 |
delay_ms(1000); |
|
341 |
orbs_set_color(CYAN,CYAN); |
|
342 |
delay_ms(1000); |
|
343 |
orbs_set_color(BLUE,BLUE); |
|
344 |
delay_ms(1000); |
|
345 |
orbs_set_color(PINK,PINK); |
|
346 |
delay_ms(1000); |
|
347 |
orbs_set_color(PURPLE,PURPLE); |
|
348 |
delay_ms(1000); |
|
349 |
orbs_set_color(MAGENTA,MAGENTA); |
|
350 |
delay_ms(1000); |
|
351 |
orbs_set_color(WHITE,WHITE); |
|
352 |
delay_ms(1000); |
|
353 |
orbs_set_color(ORB_OFF,ORB_OFF); |
|
354 |
delay_ms(1000); |
|
355 |
|
|
356 |
orbs_set_color(RED,GREEN); |
|
357 |
delay_ms(3000); |
|
358 |
|
|
21 | 359 |
return 0; |
22 | 360 |
} |
23 | 361 |
|
Also available in: Unified diff