Created
March 2, 2019 14:09
-
-
Save ringodin/3713e8b2986da8bb9ce1a20662f9dc7d to your computer and use it in GitHub Desktop.
the robot drives up and back a short distance, then turns
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(Motor, motor1, leftMotor, tmotorVexIQ, openLoop, encoder) | |
#pragma config(Motor, motor6, rightMotor, tmotorVexIQ, openLoop, reversed, encoder) | |
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// | |
/*------------------------------------------------------------------------------------------------ | |
This program will move the motors forward and backwards | |
ROBOT CONFIGURATION: VEX IQ Clawbot | |
MOTORS & SENSORS: | |
[I/O Port] [Name] [Type] [Location] | |
Port 1 leftMotor VEX IQ Motor Left side motor | |
Port 6 rightMotor VEX IQ Motor Right side motor (reversed) | |
------------------------------------------------------------------------------------------------*/ | |
task main() | |
{ | |
//Reset the current position in the motor encoder to zero. | |
resetMotorEncoder(leftMotor); | |
resetMotorEncoder(rightMotor); | |
//Set motor to run 5000 counts at power level 75. | |
moveMotorTarget(leftMotor, 500, 75); | |
moveMotorTarget(rightMotor, 500, 75); | |
//Blocking command prevents program from continuing until movement is complete. | |
waitUntilMotorStop(leftMotor); | |
waitUntilMotorStop(rightMotor); | |
sleep(1000); | |
resetMotorEncoder(leftMotor); | |
resetMotorEncoder(rightMotor); | |
moveMotorTarget(leftMotor, -500, -75); | |
moveMotorTarget(rightMotor, -500, -75); | |
waitUntilMotorStop(leftMotor); | |
waitUntilMotorStop(rightMotor); | |
sleep(1000); | |
resetMotorEncoder(leftMotor); | |
resetMotorEncoder(rightMotor); | |
moveMotorTarget(leftMotor, 500, 75); | |
moveMotorTarget(rightMotor, -500, -75); | |
waitUntilMotorStop(leftMotor); | |
waitUntilMotorStop(rightMotor); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment