 #include <Servo.h> 
 #include <NewPing.h>
 
+#define BAUD_RATE 115200
+#define SERVO_HEAD 10
 #define TRIGGER_PIN  A1  // Arduino pin tied to trigger pin on the ultrasonic sensor.
 #define ECHO_PIN     A0  // Arduino pin tied to echo pin on the ultrasonic sensor.
 #define MAX_DISTANCE 300 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

  unsigned long diff = now - lastServoTime;
  if( diff < SERVO_WAIT_TIME_MILLIS ) {
    unsigned long delayTime = SERVO_WAIT_TIME_MILLIS - diff;
    Serial.write("delaying servo movement for ms: ");
    Serial.print(delayTime, DEC);
    delay(delayTime);
  }
}

void printDistance() {
  unsigned int uS = sonar.ping(); // Send ping, get ping time in microseconds (uS).
  Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance in cm and print result (0 = outside set distance range)
}



byte index = 0; // Index into array; where to store the character

enum COMMAND {
  NONE = -1, 
  TURN_HEAD = 0, // value = servo microseconds
  SONAR = 1,        
  COMMAND_MAX
} currentCommand;

