root / trunk / code / projects / targetPractice / targetBot / main.c @ 1421
History | View | Annotate | Download (753 Bytes)
1 |
#include <dragonfly_lib.h> |
---|---|
2 |
|
3 |
int main(void) |
4 |
{ |
5 |
|
6 |
dragonfly_init(ALL_ON); |
7 |
|
8 |
int i, j, max = -1; |
9 |
int vals[16]; |
10 |
|
11 |
orbs_set_color(RED, RED); |
12 |
delay_ms(2000);
|
13 |
orbs_set_color(GREEN, GREEN); |
14 |
|
15 |
while (1) { |
16 |
|
17 |
/* Refresh and make sure the table is updated */
|
18 |
bom_refresh(BOM_ALL); |
19 |
delay_ms(100);
|
20 |
|
21 |
/* Record values into an array */
|
22 |
for (i = 0; i < 16; i++) { |
23 |
vals[i] = bom_get(i); |
24 |
if (max < vals[i])
|
25 |
max = vals[i]; |
26 |
} |
27 |
|
28 |
/* Display results */
|
29 |
for (i = 0; i < 16; i++) { |
30 |
|
31 |
usb_puti(vals[i]); |
32 |
usb_putc('\t');
|
33 |
|
34 |
for (j = 0; j < (int)((max - vals[i]) / 5); j++) { |
35 |
usb_putc('#');
|
36 |
} |
37 |
|
38 |
usb_putc('\n');
|
39 |
|
40 |
} |
41 |
|
42 |
usb_puts("Max: ");
|
43 |
usb_puti(bom_get_max()); |
44 |
usb_putc('\n');
|
45 |
usb_putc('\n');
|
46 |
|
47 |
delay_ms(400);
|
48 |
|
49 |
} |
50 |
|
51 |
return 0; |
52 |
} |
53 |
|