BO.io.DCMotor Class
Creates an interface to an H-bridge to control the direction of rotation of a motor shaft. You can rotate forward (clockwise), reverse or apply a brake. See Breakout/examples/actuators/dcmotor.html for an example application.
Tested successfully with the following H-bridge: SN754410
Should also be compatible with the following:
SN754410
L293NE
TA7291P
TB6612FNG
BD621F
Constructor
BO.io.DCMotor
-
board
-
forwardPin
-
reversePin
-
pwmPin
-
minVoltage
-
maxVoltage
-
supplyVoltage
Parameters:
-
board
IOBoardA reference to the IOBoard instance that the servo is attached to.
-
forwardPin
PinA reference to the Pin connected to the forward control of the H-bridge.
-
reversePin
PinA reference to the Pin connected to the reverse control of the H-bridge.
-
pwmPin
PinA reference to the Pin connected to the pwm control of the H-bridge.
-
minVoltage
NumberThe minimum voltage (default = 1).
-
maxVoltage
NumberThe maximum voltage (default = 9).
-
supplyVoltage
NumberThe supply voltage (default = 9).
Methods
despin
-
useBrake
Parameters:
-
useBrake
BooleanDefault = true
forward
-
val
Parameters:
-
val
NumberThe new voltage to set (0.0 to 1.0)
reverse
-
val
Parameters:
-
val
NumberThe new voltage to set (-1.0 to 0.0)
Properties
value
Number
The value of the motor speed (-1.0 to 1.0). A speed of zero stops the motor.