Revision 1851
Added turning
main.c | ||
---|---|---|
12 | 12 |
int barCode; |
13 | 13 |
while(1) |
14 | 14 |
{ |
15 |
barCode = lineFollow(); |
|
15 |
//for(int q=0; q<500; q++) |
|
16 |
barCode = lineFollow(200); |
|
17 |
if(barCode==-25)while(turnLeft()); |
|
18 |
continue; |
|
16 | 19 |
if(barCode != -2 && barCode != LINELOST) |
17 | 20 |
{ |
18 | 21 |
usb_puti(barCode); |
... | ... | |
53 | 56 |
} |
54 | 57 |
return 0; |
55 | 58 |
} |
56 |
void turnRight()
|
|
59 |
void right()
|
|
57 | 60 |
{ |
58 | 61 |
motor_r_set(BACKWARD, 200); |
59 | 62 |
motor_l_set(FORWARD, 200); |
... | ... | |
70 | 73 |
delay_ms(2000); |
71 | 74 |
} |
72 | 75 |
|
73 |
void turnLeft()
|
|
76 |
void left()
|
|
74 | 77 |
{ |
75 | 78 |
motor_l_set(BACKWARD, 200); |
76 | 79 |
motor_r_set(FORWARD, 200); |
Also available in: Unified diff