root / branches / autonomous_recharging / code / projects / libwireless / test / test.c @ 769
History | View | Annotate | Download (902 Bytes)
1 | 17 | bcoltin | #include "stdlib.h" |
---|---|---|---|
2 | #include "stdio.h" |
||
3 | |||
4 | #include "../lib/wireless.h" |
||
5 | #include "../lib/wl_error_group.h" |
||
6 | #include "../lib/wl_token_ring.h" |
||
7 | //#include "../lib/xbee.h"
|
||
8 | |||
9 | #include <time.h> |
||
10 | |||
11 | 769 | gtress | void usage (void); |
12 | |||
13 | 213 | bcoltin | int main(int argc, char** argv) |
14 | 17 | bcoltin | { |
15 | 769 | gtress | if (argc != 3) { |
16 | usage(); |
||
17 | return -1; |
||
18 | } |
||
19 | 340 | bcoltin | char c = argv[1][0]; |
20 | int robot = atoi(argv[2]); |
||
21 | wl_set_com_port("/dev/ttyUSB0");
|
||
22 | 17 | bcoltin | wl_init(); |
23 | 337 | bcoltin | wl_set_channel(0xE);
|
24 | 17 | bcoltin | printf("Wireless initialized.\n");
|
25 | printf("Packet groups initialized.\n");
|
||
26 | 213 | bcoltin | |
27 | 645 | cmar | if (c == 'g') { //command robot to requet charge |
28 | 743 | bcoltin | wl_send_robot_to_robot_global_packet(3, 9, NULL, 0, robot, 0); |
29 | 645 | cmar | } |
30 | if (c == 'd') { // command robot to depart station |
||
31 | 743 | bcoltin | wl_send_robot_to_robot_global_packet(3, 10, NULL, 0, robot, 0); |
32 | 645 | cmar | } |
33 | 17 | bcoltin | wl_terminate(); |
34 | |||
35 | return 0; |
||
36 | } |
||
37 | |||
38 | 769 | gtress | void usage (void) { |
39 | printf("Usage: test [g|d] [robot]\n\tg sends charge\n\td sends depart\n\trobot is the ID of the desired robot\n");
|
||
40 | } |
||
41 | |||
42 |