Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / targetPractice / targetBot / main.c @ 1420

History | View | Annotate | Download (804 Bytes)

1 16 bcoltin
#include <dragonfly_lib.h>
2
3 857 bcoltin
int main(void)
4
{
5 1419 jsexton
6 967 alevkoy
        /* initialize components, set wireless channel */
7 857 bcoltin
        dragonfly_init(ALL_ON);
8 1419 jsexton
9 1420 jsexton
        int i, j, max = -1;
10
        int vals[16];
11 967 alevkoy
12 1420 jsexton
        orbs_set_color(RED, RED);
13
        delay_ms(5000);
14
        orbs_set_color(GREEN, GREEN);
15
16 1394 cmar
        while (1) {
17 967 alevkoy
18 1420 jsexton
                /* Refresh and make sure the table is updated */
19 1419 jsexton
                bom_refresh(BOM_ALL);
20 1420 jsexton
                delay_ms(100);
21
22
                /* Record values into an array */
23
                for (i = 0; i < 16; i++) {
24
                        vals[i] = bom_get(i);
25
                        if (max < vals[i])
26
                                max = vals[i];
27
                }
28
29
                /* Display results */
30
                for (i = 0; i < 16; i++) {
31
32
                        usb_puti(vals[i]);
33
                        usb_putc('\t');
34
35
                        for (j = 0; j < (int)((max - vals[i]) / 5); j++) {
36
                                usb_putc('#');
37
                        }
38
39
                        usb_putc('\n');
40
41
                }
42
43
                usb_puts("Max: ");
44 1419 jsexton
                usb_puti(bom_get_max());
45
                usb_putc('\n');
46 1420 jsexton
                usb_putc('\n');
47 1419 jsexton
48 1420 jsexton
                delay_ms(400);
49 1419 jsexton
50 967 alevkoy
        }
51
52
        return 0;
53 16 bcoltin
}