User Manual

39
motorB = Motor("MotorB")
p.motor_switch(1) # motor switch on
forward_direction
Check and set the forward direction of the motor. Return 0 or 1, also can be set as 0 and 1.
direc = motorA.forward_direction # get motor forward direction
motorA.forward_direction = 0 # set motor forward direction
forward(speed)
Drive the motor to go forward in the speed of "speed".
motorA.forward(60) # drive motor forward as speed
backward(speed)
Drive the motor to go backward in the speed of "speed".
motorA.backward(60) # drive motor backward as speed
stop()
Drive the motor to stop.
motorA.stop() # motor off
speed
Set the speed of the motor, ranging between [0~100], integer, with the limited range.
motorA.speed = 60 # set motor speed
is_reversed
Set the motor to spin reversely, bool type, with warning of wrong types.
motorA.is_reversed = True # set motor turn reversed
end()
End the motor ojbect.
SunFounder