Package com.diozero.devices.sandpit
Class TB6612FNGMotor
java.lang.Object
com.diozero.api.motor.MotorBase
com.diozero.devices.sandpit.TB6612FNGMotor
- All Implemented Interfaces:
MotorInterface
,java.io.Closeable
,java.lang.AutoCloseable
public class TB6612FNGMotor extends MotorBase
Bi-directional motor controlled by a single PWM pin and separate forward / backward GPIO pins
Toshiba TB6612FNG Dual Motor Driver such as @see this one from Pololu
Turn forward, set pin 1 to HIGH, pin 2 to LOW, and PWM to >0
Turn backward, set pin 1 to LOW, pin 2 to HIGH, PWM to >0
-
Constructor Summary
Constructors Constructor Description TB6612FNGMotor(DigitalOutputDevice motorForwardControlPin, DigitalOutputDevice motorBackwardControlPin, PwmOutputDevice motorPwmControl)
-
Method Summary
Methods inherited from class com.diozero.api.motor.MotorBase
addListener, removeListener, reverse, setValue, valueChanged, whenBackward, whenForward, whenStop
-
Constructor Details
-
TB6612FNGMotor
public TB6612FNGMotor(DigitalOutputDevice motorForwardControlPin, DigitalOutputDevice motorBackwardControlPin, PwmOutputDevice motorPwmControl)
-
-
Method Details
-
close
public void close() -
forward
- Parameters:
speed
- Range 0..1- Throws:
RuntimeIOException
- if an I/O error occurs
-
backward
- Parameters:
speed
- Range 0..1- Throws:
RuntimeIOException
- if an I/O error occurs
-
stop
- Throws:
RuntimeIOException
-
getValue
Represents the speed of the motor as a floating point value between -1 (full speed backward) and 1 (full speed forward)- Throws:
RuntimeIOException
- if an I/O error occurs
-
isActive
- Throws:
RuntimeIOException
-