Created
March 11, 2019 12:25
-
-
Save ringodin/3a543bb6b3401dcc1cc765ceb20efcef to your computer and use it in GitHub Desktop.
The robot drives until the bumper switch is pressed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 !!*// | |
/*------------------------------------------------------------------------------------------------ | |
Simple program to make your robot move forward until the Bumper Sensor is triggered (pressed). | |
ROBOT CONFIGURATION: VEX IQ Clawbot | |
MOTORS & SENSORS: | |
[I/O Port] [Name] [Type] [Location] | |
Port 1 leftMotor VEX IQ Motor (Reversed) Left side motor | |
Port 6 rightMotor VEX IQ Motor Right side motor | |
Port 2 bumpSwitch VEX IQ Bumper Bumper Sensor | |
------------------------------------------------------------------------------------------------*/ | |
task main() | |
{ | |
while(getBumperValue(bumpSwitch) == 0) // Loop while robot's bumper/touch sensor isn't pressed in | |
{ | |
setMotorSpeed(leftMotor, 50); //Set the leftMotor (motor1) to half power (50) | |
setMotorSpeed(rightMotor, 50); //Set the rightMotor (motor6) to half power (50) | |
} | |
//Once the sensor is touched, the program will end and motors will stop. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment