 #include <Servo.h>
 
 const int MOTOR_PIN = 3;
+const int LED_PIN = 5;
 const int SERVO_PIN = 9;
+const int MIN_SPEED = 1;
+const int MAX_SPEED = 3;
+const int MAX_COMMAND_LENGTH = 6;
 
-boolean isMoveForward = 0;
-boolean isMoveBackward = 0;
-boolean isMoveLeft = 0;
-boolean isMoveRight = 0;
+bool isMoveForward = false;
+bool isMoveBackward = false;
+bool isMoveLeft = false;
+bool isMoveRight = false;
+bool isLedBlink = false;
+int movingSpeed = MAX_SPEED;
+char command[MAX_COMMAND_LENGTH] = "";
 
 Servo servo;
 

}

void left() {
  servo.write(40);
};
void center() {
  servo.write(90);
};
void right() {
  servo.write(140);
};

void clearCommand() {
  for (int i = 0; i < 4; i++) {
    command[i] = '0';
  }
}


  else if (isMoveRight)
    right();
  else
    center();

  if (isHeartBeat)
    blinkLed();
}

void setup() {
  Serial.begin(9600);
  servo.attach(SERVO_PIN);
  pinMode(MOTOR_PIN, OUTPUT);
  pinMode(LED_PIN, OUTPUT);
}

void loop() {
  int i = 0;
  if (Serial.available() > 0 ) {
    char ch = Serial.read();
    if (ch == '\n') {
