#!/usr/bin/python # TYPE:robotics # DESC:Takes x and y of "joystick", and generates motor speeds MID_BYTE = 128 # Get x and y xjoy = input("X? ") #0 to 255 yjoy = input("Y? ") #0 to 255 # Find speed and turn rates turnRate = xjoy - MID_BYTE speedRate = yjoy - MID_BYTE # Set motor speeds leftMotorSpeed = turnRate + speedRate rightMotorSpeed = -turnRate + speedRate print "Right motor:",rightMotorSpeed print "Left motor:",leftMotorSpeed