You are on page 1of 1

#pragma config(Sensor, S1, , sensorEV3_Touch)

#pragma config(Sensor, S2, , sensorEV3_Gyro)


#pragma config(Sensor, S4, , sensorEV3_Ultrasonic)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!
*//

task main()
{
while(1)
{

resetMotorEncoder(motorB);
if(getUSDistance(S4)<12)
{
resetMotorEncoder(motorB);
while(getMotorEncoder(motorB) < 165)
{
motor[motorB] = 50;
motor[motorC] = -50;
}
motor[motorB] = 0;
motor[motorC] = 0;
wait1Msec(100);
}
else{
motor[motorB] = 50;
motor[motorC] = 50;
wait1Msec(50);

}
}
}

You might also like