#pragma config(Sensor, S1,     touchSensor,    sensorEV3_Touch)
#pragma config(Sensor, S2,     gyroSensor,     sensorEV3_Gyro)
#pragma config(Sensor, S3,     colorSensor,    sensorEV3_Color, modeEV3Color_Color)
#pragma config(Sensor, S4,     sonarSensor,    sensorEV3_Ultrasonic)
#pragma config(Motor,  motorA,          armMotor,      tmotorEV3_Large, PIDControl, encoder)
#pragma config(Motor,  motorB,          leftMotor,     tmotorEV3_Large, PIDControl, driveLeft, encoder)
#pragma config(Motor,  motorC,          rightMotor,    tmotorEV3_Large, PIDControl, driveRight, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*
Create a program that drives the robot forward until the Ultrasound Sensor sees an object.
The robot then stops.
*/

task main()
{
	//Set motor speed at 50% (Drive Forwards).
	setMotorSpeed(motorB, 50);
	setMotorSpeed(motorC, 50);

	
	while(getUSDistance(sonarSensor) < 20)
	{
		//Keep going until the Ultrasonic Sensor sees a value less than 20cm.
	}

	//Once the Ultrasonic Sensor sees a value less than 20cm.
	//Set motor speed to 0% (Stop).
	setMotorSpeed(motorB, 0);
	setMotorSpeed(motorC, 0);
}
