Revision 213
Updated recharging code.
test.c | ||
---|---|---|
8 | 8 |
|
9 | 9 |
#include <time.h> |
10 | 10 |
|
11 |
int main() |
|
11 |
int main(int argc, char** argv)
|
|
12 | 12 |
{ |
13 |
/*unsigned char buffer[128]; |
|
14 |
xbee_lib_init(0x3331); |
|
15 |
printf("%i\n", xbee_get_address()); |
|
16 |
struct timespec delay; |
|
17 |
delay.tv_sec = 0; |
|
18 |
delay.tv_nsec = 100000000; |
|
19 |
while (1) |
|
20 |
{ |
|
21 |
int len = xbee_get_packet(buffer); |
|
22 |
if (len != -1) |
|
23 |
{ |
|
24 |
int i; |
|
25 |
for (i = 0; i < len; i++) |
|
26 |
printf("%c", buffer[i]); |
|
27 |
printf("\n\r"); |
|
28 |
} |
|
29 |
nanosleep(&delay, 0); |
|
30 |
wl_send_global_packet(1, 1, "CHECK", 3, |
|
31 |
0); |
|
32 |
} |
|
33 |
xbee_terminate();*/ |
|
13 |
int robot = atoi(argv[1]); |
|
34 | 14 |
wl_init(); |
35 |
wl_set_channel(0x1A);
|
|
15 |
wl_set_channel(0xA); |
|
36 | 16 |
printf("Wireless initialized.\n"); |
37 |
wl_error_register(); |
|
38 |
wl_token_ring_register(); |
|
39 |
wl_token_ring_join(); |
|
40 | 17 |
printf("Packet groups initialized.\n"); |
18 |
|
|
19 |
wl_send_robot_to_robot_global_packet(3, 9, NULL, 0, robot, 0); |
|
41 | 20 |
|
42 |
struct timespec delay; |
|
43 |
delay.tv_sec = 0; |
|
44 |
delay.tv_nsec = 100000000; |
|
45 |
while (1) |
|
46 |
{ |
|
47 |
//wl_error_send_string("s"); |
|
48 |
wl_do(); |
|
49 |
nanosleep(&delay, 0); |
|
50 |
} |
|
51 |
|
|
52 | 21 |
wl_terminate(); |
53 | 22 |
|
54 | 23 |
return 0; |
Also available in: Unified diff