Im making a simple car with a IR sensor on when the IR sees something in front of it,it turns right. easy right. but when the if statement in the loop is no longer true the car stops the right weal twitches the "L" LED flashes a few times then only it turns right... what gives thanks for the help in advance
int IRFront;
void setup() {
// put your setup code here, to run once:
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
pinMode(9,OUTPUT);
pinMode(8,OUTPUT);
pinMode(3, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
IRFront = digitalRead(3);
if (IRFront == 0){
digitalWrite(11, LOW);
digitalWrite(12, HIGH);
digitalWrite(9, HIGH);
digitalWrite(8, LOW);
}
else if (IRFront == 1){
digitalWrite(11, HIGH);
digitalWrite(12, LOW);
digitalWrite(9, HIGH);
digitalWrite(8, LOW);