driveLeft = -upDown driveRight = -upDown if leftRight < -0.05: # Turning left driveLeft *= 1.0 + (2.0 * leftRight) elif leftRight > 0.05: # Turning right driveRight *= 1.0 - (2.0 * leftRight) # Check for button presses if joystick.get_button(buttonResetEpo): pass if joystick.get_button(buttonSlow): driveLeft *= slowFactor driveRight *= slowFactor # Set the motors to the new speeds # PBR.SetMotor1(driveRight * maxPower) # PBR.SetMotor2(-driveLeft * maxPower) # print(driver.joystck(driveRight * maxPower), driver.joystck(-driveLeft * maxPower)) driver.motors(driver.joystck(driveRight * maxPower), driver.joystck(driveLeft * maxPower)) # Change the LED to reflect the status of the EPO latch # PBR.SetLed(PBR.GetEpo()) # Wait for the interval period time.sleep(interval) # Disable all drives # PBR.MotorsOff() except KeyboardInterrupt: # CTRL+C exit, disable all drives # PBR.MotorsOff() pass