root / branches / autonomous_recharging / code / projects / autonomous_recharging / dragonfly / main.c @ 213
History | View | Annotate | Download (776 Bytes)
1 |
#include <dragonfly_lib.h> |
---|---|
2 |
#include <wireless.h> |
3 |
#include <wl_token_ring.h> |
4 |
#include <rangefinder.h> |
5 |
#include "smart_run_around_fsm.h" |
6 |
|
7 |
#include "recharge.h" |
8 |
|
9 |
void do_nothing2(void) {} |
10 |
int get_nothing2(void) {return 0;} |
11 |
|
12 |
int main(void) |
13 |
{ |
14 |
dragonfly_init(ALL_ON); |
15 |
usb_puts("Initializing wireless.\n");
|
16 |
range_init(); |
17 |
orb_enable(); |
18 |
wl_init(); |
19 |
wl_set_channel(0xA);
|
20 |
//orb_set_color(YELLOW);
|
21 |
wl_token_ring_register(); |
22 |
wl_token_ring_set_bom_functions(do_nothing2, do_nothing2, get_nothing2); |
23 |
wl_token_ring_join(); |
24 |
usb_puts("Wireless initialized.\n");
|
25 |
recharge_init(); |
26 |
usb_puts("Recharging initialized.\n");
|
27 |
//run_around_init();
|
28 |
while (1) |
29 |
{ |
30 |
wl_do(); |
31 |
int charging = recharge_do();
|
32 |
if (!charging)
|
33 |
{ |
34 |
analog8(IR5); |
35 |
//run_around_FSM();
|
36 |
} |
37 |
} |
38 |
|
39 |
return 0; |
40 |
} |
41 |
|