2019-04-13 14:21:59 +00:00
|
|
|
int recv = 0;
|
2019-04-13 13:58:15 +00:00
|
|
|
|
2019-04-13 14:21:59 +00:00
|
|
|
// 0 FORWARD
|
|
|
|
// 1 BACKWARD
|
|
|
|
// 2 LEFT
|
|
|
|
// 3 RIGHT
|
2019-04-13 13:58:15 +00:00
|
|
|
|
|
|
|
void setup() {
|
2019-04-13 14:21:59 +00:00
|
|
|
Serial.begin(115200); //initial the Serial
|
2019-04-13 13:58:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
2019-04-13 14:21:59 +00:00
|
|
|
|
|
|
|
if (Serial.available()) {
|
|
|
|
|
|
|
|
switch (Serial.read())
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
Serial.println("MOVING FORWARD");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
Serial.println("MOVING BACKWARD");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
Serial.println("MOVING LEFT");
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
Serial.println("MOVING RIGHT");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Serial.println("INVALID INSTRUCTION");
|
|
|
|
}
|
2019-04-13 13:58:15 +00:00
|
|
|
|
2019-04-13 14:21:59 +00:00
|
|
|
}
|
2019-04-13 13:58:15 +00:00
|
|
|
}
|