 }
 
 
-
+//Sweeps the steering servo
 void sweep(){
   set_steer_angle(0);
   delay(100);
   //sweep steering
-  for(int i=-90;i<90;i++){
+  for(int i=-45;i<45;i++){
     set_steer_angle(i);
     delay(10);
   }
-  for(int i=90;i>=-90;i--){
+  for(int i=45;i>=-45;i--){
     set_steer_angle(i);
     delay(10);
   }

  delay(600);
}


void setup() {
  steering_servo.attach(9);  // attaches the servo on pin 9 to the servo object
  throttle_servo.attach(11);  // attaches the servo on pin 9 to the servo object
  
  delay(1);
  sweep();
  launch();
  //WHOAH stop this bad boy
  set_throttle_position(-100);
  delay(3000);
}


void loop() {

  set_steer_angle(90);
  delay(10);
  set_throttle_position(20);
  delay(5000);
  reverse(20);
  delay(5000);
  
  set_throttle_position(0);
  delay(1000);
  sweep();
  
}

/*
 * Be sure to first calibrate the ESC. This program controls a Traxxas Slash 2 wheel drive
 * with XL5 speed controller
 */
#include <Servo.h>


const int STEER_IN = 5;
const int STEER_OUT = 9;
const int STEER_BASE = 1475;
const int STEER_MIN = 970;
const int STEER_MAX = 1930;
const int STEER_BIAS = 2; //set this to adjust steering

const int THROTTLE_IN = 6;
const int THROTTLE_OUT = 11;
const int THROTTLE_BASE = 1462;
const int THROTTLE_MIN = 975;
const int THROTTLE_MAX = 1962;

const int LED_GREEN = 2;
const int LED_RED = 3;




//servos
Servo steering_servo;
Servo throttle_servo;

int steer_input;
int throttle_input;

//make sure we have a transmitter so that we can safety stop the car
bool TX_found, TX_high, TX_low;
bool manual_mode = false;



//sets the steering angle between -45, 45 for full left /right respectively. set to zero for straight ahead
void set_steer_angle(int angle){
  angle = angle + STEER_BIAS;
  int map_angle = map(angle, -45, 45, 0, 180);
  steering_servo.write(map_angle);
}

//when using the transmitter, map the steering to the TX output
void set_steer_angle_manual(int sp){  
  int map_angle = map(sp, STEER_MIN, STEER_MAX, -45, 45);
  set_steer_angle(map_angle);
}

//controls the acceleration/deccelration of the robot. -100 is full break to 100 full gas
void set_throttle_position(int sp){
  int map_throttle = map(sp, -100, 100, 1000, 2000);
  throttle_servo.writeMicroseconds(map_throttle);
}

//when using the transmitter, map the throttle to the TX output
void set_throttle_position_manual(int sp){  
  int map_throttle = map(sp, THROTTLE_MIN, THROTTLE_MAX, -100, 100);
  set_throttle_position(map_throttle);
}


//set a reverse speed, 3 second delay to make sure the vehicle is stopped, 
//range is 0 to 100 for min max reverse
void reverse(int sp){
  set_throttle_position(-100);
  delay(3000);
