Paso 5:
Este es un programa de seguidor de línea simple
int leftInput = 3;
int rightInput = 2;
int leftMotor = 1;
int rightMotor = 0;
int leftValue = 0;
derechovalor int = 0;
void setup() {}
Serial.Begin(9600);
pinMode (leftMotor, salida);
pinMode (rightMotor, salida);
}
void loop() {}
leftValue = digitalRead(leftInput);
derechovalor = digitalRead(rightInput);
Si (leftValue == alto & & derechovalor == HIGH)
{
digitalWrite (leftMotor, HIGH); digitalWrite (rightMotor, HIGH);
} else {}
Si (leftValue == baja & & derechovalor == HIGH)
{
digitalWrite (leftMotor, bajo); digitalWrite (rightMotor, HIGH);
} else {}
Si (leftValue == alto & & derechovalor == LOW)
{
digitalWrite (rightMotor, bajo);
digitalWrite (leftMotor, HIGH);
} else {}
Si (leftValue == baja & & derechovalor == LOW)
{
digitalWrite (rightMotor, bajo);
digitalWrite (leftMotor, bajo);
}}
}
}}