Update LineFollower authored by Markus Klinik's avatar Markus Klinik
hello ```c
\ No newline at end of file int main() {
int repeat = 1;
while( repeat == 1 ) {
repeat = loop();
}
Stop();
return 0;
}
int loop(){
int l = SensorLeft.read();
int r = SensorRight.read();
if((l==LOW) && (r==LOW)) {
MoveForward();
} else
if((l==HIGH) && (r==HIGH)) {
return 0;
} else
if((l==LOW) && (r==HIGH)) {
TurnLeft();
} else
if((l==HIGH) && (r==LOW)) {
TurnRight();
}
delay(20);
return 1;
}
void MoveForward() {
MotorLeft.Forward();
MotorRight.Forward();
}
void TurnRight() {
MotorLeft.Forward();
MotorRight.Stop();
}
void TurnLeft() {
MotorLeft.Stop();
MotorRight.Forward();
}
void Stop() {
MotorLeft.Stop();
MotorRight.Stop();
}
void delay(int ms) {
}
int LOW = 0;
int HIGH = 1;
```
\ No newline at end of file