task autonomous()
{
	if(sensorValue(redBlueSwitch) < SWITCH){
		red = true;
	}
	else{
		red = false;
	}
	if(red){
		motor[hook] = -127;
		wait10Msec(60);
		motor[hook] = 64;
		wait10Msec(200);
		motor[hook] = 0;
		turnCW(159, 127);
		wait10Msec(1);
		move(1.3,127);
		wait10Msec(1);
		turnCCW(161, 127);
		wait10Msec(1);
		move(1.1,127);
		wait10Msec(1);
		move(.7,-127);
		wait10Msec(1);
		turnCW(125,127);
		wait10Msec(1);
		move(1.1,127);
		wait10Msec(1);
		turnCCW(125,127);
		wait10Msec(1);
		move(1.4,127);
		wait10Msec(1);
		move(.7,-127);
		wait10Msec(1);
		turnCCW(45,127);
		wait10Msec(1);
		move(1.5,127);
		wait10Msec(1);
	}
	else{
		motor[hook] = -127;
		wait10Msec(60);
		motor[hook] = 64;
		wait10Msec(200);
		motor[hook] = 0;
		turnCCW(159, 127);
		wait10Msec(1);
		move(1.3,127);
		wait10Msec(1);
		turnCW(161, 127);
		wait10Msec(1);
		move(1.1,127);
		wait10Msec(1);
		move(.7,-127);
		wait10Msec(1);
		turnCCW(125,127);
		wait10Msec(1);
		move(1.1,127);
		wait10Msec(1);
		turnCW(125,127);
		wait10Msec(1);
		move(1.4,127);
		wait10Msec(1);
		move(.7,-127);
		wait10Msec(1);
		turnCW(45,127);
		wait10Msec(1);
		move(1.5,127);
		wait10Msec(1);
	}
}
task main()
{
  initializeRobot();

  waitForStart(); // Wait for the beginning of autonomous phase.
  task main()
{

while(SensorValue(touchSensor) == 1)
{
	motor[arm) = 100;
}
while(sensorValue(touchSensor) == 0)
{
	motor[arm] = 100;
}
motor[arm] = 0;

}

  //motor[arm] = -100;
  //wait1Msec(2000);
  //motor[arm] = 0;
 // while(SensorValue[touch] == 0)
 // {
	//  if(SensorValue[touch] == 0)
	//  {
	//  	motor[arm] = 100;
	//  }
	//  else
	//  {
	//  	motor[arm] = 0;
	//  }
	//}
	//motor[arm] = 0;
	//while(SensorValue[touch] == 0)
 // {
	//  if(SensorValue[touch] == 0)
	//  {
	//  	motor[arm] = -100;
	//  }
	//  else
	//  {
	//  	motor[arm] = 0;
	//  }
	//}
  ////motor[arm] = 0;
  ////wait1Msec(500);
  //if(SensorValue[touch] == 0)
  //{
  //	motor[arm] = 100;
  //}
  //motor[arm] = 0;

 // while(SensorValue[touch] == 1)//while sensor is pressed the arm goes up
	//{
	//	motor[arm] = 100;
	//}
	//motor[arm] = 0;//stop the arm (for troubleshooting)
	//wait1Msec(500);
	//while(SensorValue[touch] == 0)//while the sensor is not pressed the arm goes the rest of the way up
	//{
	//	motor[arm] = 100;
	//}
	//motor[arm] = 0;//motor stops at the top

  while (true)
  {}
}