Revision 1218
Fixing Station/Robot communication
main.c | ||
---|---|---|
40 | 40 |
{ |
41 | 41 |
dragonfly_init (0); |
42 | 42 |
orb_init (); |
43 |
orbs_set (0, 0,255,0,0,0); |
|
43 |
|
|
44 |
// Initialize before using USB |
|
45 |
comm_server_init (); |
|
46 |
|
|
47 |
orb1_set (0, 0, 255); |
|
48 |
comm_robot_init (); |
|
49 |
orb2_set (0, 0, 255); |
|
50 |
|
|
51 |
int16_t left=69, right=105; |
|
52 |
|
|
53 |
while (1) |
|
54 |
{ |
|
55 |
robot_set_motors (motor_direction_backward, 250, motor_direction_forward, 250); |
|
56 |
delay_ms (200); |
|
57 |
} |
|
58 |
|
|
59 |
// Encoder test |
|
60 |
while (0) |
|
61 |
{ |
|
62 |
bool result=robot_read_encoders (&left, &right); |
|
63 |
usb_puti (result); |
|
64 |
usb_puts (" "); |
|
65 |
usb_puti (left); |
|
66 |
usb_puts (" "); |
|
67 |
usb_puti (right); |
|
68 |
usb_puts (NL); |
|
69 |
|
|
70 |
delay_ms (200); |
|
71 |
} |
|
72 |
|
|
44 | 73 |
while (1); |
45 | 74 |
return 0; |
46 | 75 |
} |
... | ... | |
114 | 143 |
hardware_init (); |
115 | 144 |
|
116 | 145 |
orb1_set (255, 0, 0); usb_puts("# Initializing wireless" NL); |
117 |
xbee_init (); |
|
118 |
wl_init(); |
|
146 |
comm_robot_init (); |
|
119 | 147 |
orb2_set (255, 0, 0); usb_puts("# Done" NL); |
120 | 148 |
|
121 | 149 |
// If button 1 is pressed after initialization of the wireless (which takes about 1s), run all tests. |
... | ... | |
134 | 162 |
} |
135 | 163 |
|
136 | 164 |
while (1); |
165 |
return 0; |
|
137 | 166 |
} |
Also available in: Unified diff