Tank Drive
This section will highlight how to code tank drive.
Tank Drive
Tank Coding (Basic)
Tank Coding (Advanced)
def when_started1():
RightDrive.spin(FORWARD) # Spin the motors to so we can adjust the speed later with the sticks
LeftDrive.spin(FORWARD)
while True:
LeftDrive.set_velocity(controller.axisA.position(), PERCENT) # Set the left drive speed to the controller axis A (left y)
RightDrive.set_velocity((controller.axisD.position()), PERCENT) # Set the right drive speed to the controller axis D (right y)
wait(20, MSEC)
when_started1() # Call our loopint whenStarted1() {
RightDrive.spin(forward); // Spin the motors to so we can adjust the speed later with the sticks
LeftDrive.spin(forward);
while (true) {
LeftDrive.setVelocity(Controller.AxisA.position(), percent); // Set the left drive speed to the controller axis A (left y)
RightDrive.setVelocity(Controller.AxisD.position(), percent); // Set the right drive speed to the controller axis D (right y)
wait(20, msec);
}
return 0;
}
int main() {
vexcodeInit();
whenStarted1();
}Last updated
Was this helpful?


