Revision 1778
changed joystick player robot to have dleays between motion states. It's now less responsive but also resets much less
main.c | ||
---|---|---|
128 | 128 |
} |
129 | 129 |
break; |
130 | 130 |
case WAIT: |
131 |
motor1_set(0,0); |
|
132 |
motor2_set(0,0); |
|
131 | 133 |
orbs_set_color(BLUE, BLUE); |
132 | 134 |
delay_ms(WAIT_DELAY_MS); |
133 | 135 |
state = HUNTER; |
... | ... | |
169 | 171 |
int times; |
170 | 172 |
int frontIR = 0; |
171 | 173 |
int maxBOM = 0; |
174 |
static int last = 0; |
|
172 | 175 |
|
173 | 176 |
/* if we are in WAIT, don't move or tag */ |
174 | 177 |
if(state == WAIT) |
175 | 178 |
return; |
176 | 179 |
|
180 |
/* usb_puti(type); usb_putc('\n'); */ |
|
181 |
|
|
182 |
/* // If the robot is changing direction, stop it for a bit first */ |
|
183 |
/* if (last != type) { */ |
|
184 |
/* if( (last == CNTL_FORWARD || last == CNTL_BACK || last == CNTL_LEFT || last == CNTL_RIGHT) && */ |
|
185 |
/* (type == CNTL_FORWARD || type == CNTL_BACK || type == CNTL_LEFT || type == CNTL_RIGHT)) { */ |
|
186 |
/* usb_puts("x\n"); */ |
|
187 |
/* motor1_set(0,0); */ |
|
188 |
/* motor2_set(0,0); */ |
|
189 |
/* delay_ms(100); */ |
|
190 |
/* } */ |
|
191 |
/* } */ |
|
192 |
|
|
193 |
/* last = type; */ |
|
194 |
|
|
177 | 195 |
switch (type) { |
178 | 196 |
case CNTL_FORWARD: |
179 | 197 |
motor1_set(1, 250); |
... | ... | |
182 | 200 |
case CNTL_STOP: |
183 | 201 |
motor1_set(0, 0); |
184 | 202 |
motor2_set(0, 0); |
203 |
delay_ms(220); // 100:200 |
|
185 | 204 |
break; |
186 | 205 |
case CNTL_BACK: |
187 | 206 |
motor1_set(0, 250); |
Also available in: Unified diff