Revision 1571
working version of wednesday 18 nov
trunk/code/behaviors/formation_control/circle_spacing/circle_spacing.c | ||
---|---|---|
39 | 39 |
wl_set_channel(12); |
40 | 40 |
int data_length; |
41 | 41 |
unsigned char *packet_data; |
42 |
char send_buffer; |
|
42 |
char send_buffer[2];
|
|
43 | 43 |
|
44 | 44 |
|
45 | 45 |
if(master) orb1_set_color(RED); |
... | ... | |
58 | 58 |
if(master) |
59 | 59 |
{ |
60 | 60 |
|
61 |
if(sending_counter++>100)
|
|
61 |
if(sending_counter++>2)
|
|
62 | 62 |
{ |
63 | 63 |
switch_sending(); |
64 | 64 |
sending_counter = 0; |
65 |
send_buffer = 'a'; |
|
65 |
send_buffer[0] = 'a';
|
|
66 | 66 |
wl_basic_send_global_packet(42, send_buffer, 1); |
67 | 67 |
} |
68 | 68 |
|
... | ... | |
80 | 80 |
{ |
81 | 81 |
if(bom_get_max()+1==5) |
82 | 82 |
{ |
83 |
send_buffer = 's'; |
|
84 |
wl_basic_send_global_packet(42, send_buffer, 1);
|
|
83 |
send_buffer[0] = 's';
|
|
84 |
wl_basic_send_global_packet(42, send_buffer, 2);
|
|
85 | 85 |
} |
86 | 86 |
} |
87 | 87 |
} |
... | ... | |
95 | 95 |
|
96 | 96 |
if(sending) |
97 | 97 |
{ |
98 |
/* |
|
98 | 99 |
motor_l_set(FORWARD,0); |
99 | 100 |
motor_r_set(FORWARD,0); |
101 |
*/ |
|
100 | 102 |
} |
101 | 103 |
|
102 | 104 |
else // recieving |
... | ... | |
104 | 106 |
|
105 | 107 |
if(stop) |
106 | 108 |
{ |
109 |
motor_l_set(FORWARD,0); |
|
110 |
motor_r_set(FORWARD,0); |
|
111 |
orb1_set_color(GREEN); |
|
107 | 112 |
} |
108 | 113 |
|
109 | 114 |
else |
... | ... | |
111 | 116 |
|
112 | 117 |
|
113 | 118 |
if(bom_get_max()+1==8){ |
114 |
orb1_set_color(RED);
|
|
119 |
orb2_set_color(BLUE);
|
|
115 | 120 |
motor_r_set(FORWARD,180); |
116 | 121 |
motor_l_set(FORWARD,180); |
117 | 122 |
|
118 | 123 |
} |
119 | 124 |
else { |
125 |
orb2_set_color(GREEN); |
|
120 | 126 |
motor_l_set(FORWARD,0); |
121 | 127 |
motor_r_set(FORWARD,180); |
122 | 128 |
} |
Also available in: Unified diff