Project

General

Profile

Statistics
| Revision:

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

History | View | Annotate | Download (804 Bytes)

1
#include <dragonfly_lib.h>
2

    
3
int main(void)
4
{
5

    
6
        /* initialize components, set wireless channel */
7
        dragonfly_init(ALL_ON);
8
        
9
        int i, j, max = -1;
10
        int vals[16];
11

    
12
        orbs_set_color(RED, RED);
13
        delay_ms(5000);
14
        orbs_set_color(GREEN, GREEN);
15

    
16
        while (1) {
17

    
18
                /* Refresh and make sure the table is updated */
19
                bom_refresh(BOM_ALL);
20
                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
                usb_puti(bom_get_max());
45
                usb_putc('\n');
46
                usb_putc('\n');
47

    
48
                delay_ms(400);
49

    
50
        }
51

    
52
        return 0;
53
}
54