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:
-
boardIOBoardA reference to the IOBoard instance that the servo is attached to.
-
forwardPinPinA reference to the Pin connected to the forward control of the H-bridge.
-
reversePinPinA reference to the Pin connected to the reverse control of the H-bridge.
-
pwmPinPinA reference to the Pin connected to the pwm control of the H-bridge.
-
minVoltageNumberThe minimum voltage (default = 1).
-
maxVoltageNumberThe maximum voltage (default = 9).
-
supplyVoltageNumberThe supply voltage (default = 9).
Methods
despin
-
useBrake
Parameters:
-
useBrakeBooleanDefault = true
forward
-
val
Parameters:
-
valNumberThe new voltage to set (0.0 to 1.0)
reverse
-
val
Parameters:
-
valNumberThe 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.
