Motor/motor.ino

38 lines
599 B
C++

int recv = 0;
// 0 FORWARD
// 1 BACKWARD
// 2 LEFT
// 3 RIGHT
void setup() {
Serial.begin(115200); //initial the Serial
}
void loop() {
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");
}
}
}