void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("press'0':stop");
Serial.println("press'1':back");
Serial.println("press'2':go");
Serial.println("press'3':trun left");
Serial.println("press'4':turn right");
motor3.setSpeed(255);
motor4.setSpeed(255);// set the speed to 200/255
}
void loop()
{
if(Serial.available())
{
char key=Serial.read();
Serial.print("key=");
Serial.println(key);
if (key=='0')
{
Serial.print("stop");
motor3.run(RELEASE);
motor4.run(RELEASE);// turn it on going forward
delay(5000);
}
else if (key=='1')
{
Serial.print("back");
motor3.run(BACKWARD);
motor4.run(BACKWARD);// the other way
delay(5000);
}
else if (key=='2')
{
Serial.print("go");
motor3.run(FORWARD);
motor4.run(FORWARD);// the other way
delay(5000);
}
else if (key=='4')
{
Serial.print("right");
motor3.run(RELEASE);
motor4.run(FORWARD);// the other way
delay(5000);