Code: #pragma config(Sensor, port9, bumpSwitch, sensorVexIQ_Touch) #pragma config(Motor, motor1, leftMotor, tmotorVexIQ, openLoop, encoder) #pragma config(Motor, motor6, rightMotor, tmotorVexIQ, openLoop, reversed, encoder) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main() { while(getBumperValue(bumpSwitch) == 0) // Loop while robot's bumper/touch sensor isn't pressed in { setMotorSpeed(leftMotor, 63); //Set the leftMotor (motor1) to half power (63) setMotorSpeed(rightMotor, 63); //Set the rightMotor (motor6) to half power (63) } //Once the sensor is touched, the program will end and motors will stop. }
|