from Motor import *
PWM=Motor()
def test_Motor():
try:
PWM.setMotorModel(1000,1000,1000,1000) #Forward
print "The car is moving forward"
time.sleep(1)
PWM.setMotorModel(-1000,-1000,-1000,-1000) #Back
print "The car is going backwards"
time.sleep(1)
PWM.setMotorModel(-1500,-1500,2000,2000) #Left
print "The car is turning left"
time.sleep(1)
PWM.setMotorModel(2000,2000,-1500,-1500) #Right
print "The car is turning right"
time.sleep(1)
PWM.setMotorModel(0,0,0,0) #Stop
print "\nEnd of program"
except KeyboardInterrupt:
PWM.setMotorModel(0,0,0,0)
print "\nEnd of program"
setMotorModel(data1,data2,data3,data4)
This function has four input parameters that control the left front motor, the left rear motor, the right front
motor, and the right rear motor. When the input parameter is within 0~4096, the motor will rotate forward.
If it is within -4096~0, the motor will rotate reversely. The larger the absolute value is, the faster the motor
is. When the input is 0, the motor will stop. If the function is input as follows: setMotorModel(2000,2000,
2000, 2000), four motors will rotate forward and the car will move forward.