//Left Sensor (LSP) on digitalPin 2 2//Right sensor (RSP) on digitalPin 3
//Left Motor connected to 4,5 digitalPins 5//Right Motor connected to 18,9 digitalPins
int LMP 8;
int LMN-9;1
int RMP 6;
int RMN 7;
void setup() {
pinMode(LMP, OUTPUT);
//Motor Pins are OUTPUT
pinMode(LMN, OUTPUT);
pinMode(RMP, OUTPUT);
pinMode(RMN, OUTPUT);
Serial.begin(9600);
}
void loop() {
if (Serial.available())
[
String Direction Serial.readString();
{
if (Direction "F")
//Move Forward
digitalWrite(LMP, HIGH);
digitalWrite(LMN, LOW);
digitalWrite(RMP, LOW);
digitalWrite(RMN, HIGH);
}
else if (Direction = "B")
{
//Move backward
digitalWrite(LMP, LOW);
digitalWrite(LMN, HIGH);
digitalWrite(RMP, HIGH);
digitalWrite(RMN, LOW);
}