root / branches / autonomous_recharging / code / projects / libwireless / test / test.c @ 769
History | View | Annotate | Download (902 Bytes)
| 1 | #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 | void usage (void); |
| 12 | |
| 13 | int main(int argc, char** argv) |
| 14 | {
|
| 15 | if (argc != 3) { |
| 16 | usage(); |
| 17 | return -1; |
| 18 | } |
| 19 | char c = argv[1][0]; |
| 20 | int robot = atoi(argv[2]); |
| 21 | wl_set_com_port("/dev/ttyUSB0");
|
| 22 | wl_init(); |
| 23 | wl_set_channel(0xE);
|
| 24 | printf("Wireless initialized.\n");
|
| 25 | printf("Packet groups initialized.\n");
|
| 26 | |
| 27 | if (c == 'g') { //command robot to requet charge |
| 28 | wl_send_robot_to_robot_global_packet(3, 9, NULL, 0, robot, 0); |
| 29 | } |
| 30 | if (c == 'd') { // command robot to depart station |
| 31 | wl_send_robot_to_robot_global_packet(3, 10, NULL, 0, robot, 0); |
| 32 | } |
| 33 | wl_terminate(); |
| 34 | |
| 35 | return 0; |
| 36 | } |
| 37 | |
| 38 | 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 | |
| 43 |