 // ef:             Exit fail safe. Once fail-safe mode is entered, you must
 //                 use this command to exit.
 
+#include <Servo.h> 
+
 //////////////////////////////////////////////
 // UTILITY routines.
 

// Values designating the motors.
const int LEFT_MOTOR = 0;
const int RIGHT_MOTOR = 1;

// Configure motor hardware.
void setup_motors()
{
    // TODO: Configure motor hardware.
}

// Set a motor to a particular speed, or off.

//         100 is full forward, -100 is full reverse
void set_motor(int motor, int speed)
{
    // CONSIDER: Should setting a motor to non-zero automatically turn the brakes
    // off?
  
      // Motors are controlled by PWM so we are using servo classes to control them.
    // 180 is full forward, 90 is off, and 0 is full backward
    int servoValue = (speed + 100)* 9 / 10; // scale (-100 to 100) to (0 to 180)

    if (motor == LEFT_MOTOR)
    {
        left_motor_controller.write(servoValue);
        log(F("Set left motor to:"), speed);
        log(F(" Left PWM value is:"), servoValue);
    }
    else if (motor == RIGHT_MOTOR)
    {
        right_motor_controller.write(servoValue);
        log(F("Set right motor to:"), speed);
        log(F(" Right PWM value is:"), servoValue);
    }
}

///////////////////////////////////////////////
