Revision 1528
Finished function which prints the BOM intensity histogram over USB. Will print nicely in both windows and linux (uses "\r\n"). Will accept an array
pointer to print values already collected, or it will recollect current values and print.
main.c | ||
---|---|---|
12 | 12 |
#include <dragonfly_lib.h> |
13 | 13 |
#include <wl_basic.h> |
14 | 14 |
|
15 |
/* Time delay which determines how long the robot circles before it |
|
16 |
* changes direction. */ |
|
17 |
#define TIME_DELAY 5000 |
|
18 |
|
|
19 | 15 |
int main (void) { |
20 | 16 |
|
21 | 17 |
/* Initialize the dragonfly boards, the xbee, and the encoders */ |
22 | 18 |
dragonfly_init(ALL_ON); |
23 | 19 |
xbee_init(); |
24 | 20 |
encoders_init(); |
21 |
|
|
22 |
int vals[16]; |
|
23 |
int i; |
|
24 |
|
|
25 |
while(1) { |
|
26 |
|
|
27 |
bom_refresh(BOM_ALL); |
|
28 |
for (i = 0; i < 16; i++) { |
|
29 |
vals[i] = bom_get(i); |
|
30 |
} |
|
25 | 31 |
|
26 |
while (1) { |
|
27 |
/* Drive left, set orbs, and wait */ |
|
28 |
orbs_set_color(RED, GREEN); |
|
29 |
motor_l_set(FORWARD, 160); |
|
30 |
motor_r_set(FORWARD, 255); |
|
31 |
delay_ms(TIME_DELAY); |
|
32 |
|
|
33 |
/* Drive right, change orb colors, and wait */ |
|
34 |
orbs_set_color(PURPLE, BLUE); |
|
35 |
motor_l_set(FORWARD, 255); |
|
36 |
motor_r_set(FORWARD, 160); |
|
37 |
delay_ms(TIME_DELAY); |
|
32 |
bom_print_usb(vals); |
|
33 |
delay_ms(100); |
|
38 | 34 |
} |
39 | 35 |
|
40 | 36 |
} |
Also available in: Unified diff