Created
November 2, 2016 23:00
-
-
Save jononon/f0432da9b2a008bc0e22a166743388e7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
void setLeftWheelSpeed(int speed) { | |
motor[leftWheel1] = speed; | |
motor[leftWheel2] = speed; | |
motor[leftWheel3] = speed; | |
motor[leftWheel4] = speed; | |
} | |
void setRightWheelSpeed(int speed) { | |
motor[rightWheel1] = speed; | |
motor[rightWheel2] = speed; | |
motor[rightWheel3] = speed; | |
motor[rightWheel4] = speed; | |
} | |
void drivebase (int left, int right, int deadbands) { | |
setLeftWheelSpeed(abs(left)<deadbands?0:left); | |
setRightWheelSpeed(abs(right)<deadbands?0:right); | |
} | |
void lift (int power) { | |
motor[leftLift] = power; | |
motor[rightLift] = power; | |
} | |
task main () { | |
while(true) { | |
drivebase(vexRT(Ch3), vexRT(Ch2), 10); | |
if(vexRT(Btn8U)) | |
lift(127); | |
else if(vexRT(Btn8D)) | |
lift(-127); | |
else | |
lift(0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment