task main() { while(getBumperValue(bumpSwitch) == 0) // Instructs robot to do nothing while the touch sensor isn't pressed { //Idle Loop - Will continuously check the while loop's condition } while(getBumperValue(bumpSwitch) == 1) // Loop while robot's bumper/touch sensor IS pressed in { setMotorSpeed(leftMotor, 50); //Set the leftMotor (motor1) to half power (50) setMotorSpeed(rightMotor, 50); //Set the rightMotor (motor6) to half power (50) } }
task main() { int distanceBack = 1; if (getBumperValue(bumpSwitch) = 1) { int rightEncoder = getMotorEncoder(rightMotor); while ((getMotorEncoder(rightMotor)) > (getMotorEncoder(rightMotor)-distanceBack)) { moveBackward(SLOW); } void armClose(); } }
/// returns whether or not robot is pressed up against something bool limitSwitchPressed(){ return getBumperValue(limitSwitchSensor); }