Class BO.io.DCMotor
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.
Defined in: DCMotor.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
BO.io.DCMotor(board, forwardPin, reversePin, pwmPin, minVoltage, maxVoltage, supplyVoltage)
H-bridge motor control.
|
| Field Attributes | Field Name and Description |
|---|---|
|
The value of the motor speed (-1.0 to 1.0).
|
| Method Attributes | Method Name and Description |
|---|---|
|
despin(useBrake)
|
|
|
forward(val)
|
|
|
reverse(val)
|
Class Detail
BO.io.DCMotor(board, forwardPin, reversePin, pwmPin, minVoltage, maxVoltage, supplyVoltage)
H-bridge motor control.
Tested successfully with the following H-bridge: SN754410
Should also be compatible with the following:
SN754410
L293NE
TA7291P
TB6612FNG
BD621F
- Parameters:
- {IOBoard} board
- A reference to the IOBoard instance that the servo is attached to.
- {Pin} forwardPin
- A reference to the Pin connected to the forward control of the H-bridge.
- {Pin} reversePin
- A reference to the Pin connected to the reverse control of the H-bridge.
- {Pin} pwmPin
- A reference to the Pin connected to the pwm control of the H-bridge.
- {Number} minVoltage
- The minimum voltage (default = 1).
- {Number} maxVoltage
- The maximum voltage (default = 9).
- {Number} supplyVoltage
- The supply voltage (default = 9).
Field Detail
{Number}
value
The value of the motor speed (-1.0 to 1.0). A speed of zero stops the motor.
Method Detail
despin(useBrake)
- Parameters:
- {Boolean} useBrake
- Default = true
forward(val)
- Parameters:
- {Number} val
- The new voltage to set (0.0 to 1.0)
reverse(val)
- Parameters:
- {Number} val
- The new voltage to set (-1.0 to 0.0)
