Revision 1970
Linefollowing:
added #defines around orb statements to keep them from interfering with other
orb control statements.
lineFollow.c | ||
---|---|---|
72 | 72 |
{ |
73 | 73 |
if(lost++ > 20) |
74 | 74 |
{ |
75 |
#ifdef ORB_LINEFOLLOW |
|
75 | 76 |
orb2_set_color(GREEN); |
77 |
#endif |
|
76 | 78 |
motors_off(); |
77 | 79 |
return LINELOST; |
78 | 80 |
} |
... | ... | |
81 | 83 |
{ |
82 | 84 |
if(intersectionFilter++ > 4) |
83 | 85 |
{ |
86 |
#ifdef ORB_LINEFOLLOW |
|
84 | 87 |
orb2_set_color(RED); |
88 |
#endif |
|
85 | 89 |
barCodePosition[0]=0; |
86 | 90 |
barCodePosition[1]=0; |
87 | 91 |
disableBarCode=50; |
... | ... | |
91 | 95 |
else |
92 | 96 |
{ |
93 | 97 |
position*=30; |
98 |
#ifdef ORB_LINEFOLLOW |
|
94 | 99 |
orb2_set_color(ORB_OFF); |
100 |
#endif |
|
95 | 101 |
motorLeft(min(speed+position, 255)); |
96 | 102 |
motorRight(min(speed-position, 255)); |
97 | 103 |
lost=0; |
... | ... | |
207 | 213 |
// Using this for debugging, take it out soon! |
208 | 214 |
motor_l_set(FORWARD,0); |
209 | 215 |
motor_r_set(FORWARD,0); |
216 |
#ifdef ORB_LINEFOLLOW |
|
210 | 217 |
//orb_set_color(WHITE); |
218 |
#endif |
|
211 | 219 |
delay_ms(2000); |
212 | 220 |
} |
213 | 221 |
|
... | ... | |
405 | 413 |
|
406 | 414 |
/*if(curColor == LBLACK) |
407 | 415 |
{ |
416 |
#ifdef ORB_LINEFOLLOW |
|
408 | 417 |
orb_set_color(RED); |
418 |
#endif |
|
409 | 419 |
} |
410 | 420 |
else |
411 | 421 |
{ |
422 |
#ifdef ORB_LINEFOLLOW |
|
412 | 423 |
orb_set_color(BLUE); |
424 |
#endif |
|
413 | 425 |
}*/ |
414 | 426 |
|
415 | 427 |
duration[i] = 0; |
... | ... | |
427 | 439 |
bitColor[i] = LWHITE; |
428 | 440 |
} |
429 | 441 |
isReset[i] = 1; |
442 |
#ifdef ORB_LINEFOLLOW |
|
430 | 443 |
orb_set(0, 0, 0); |
444 |
#endif |
|
431 | 445 |
} |
432 | 446 |
} |
433 | 447 |
|
Also available in: Unified diff