Package com.diozero.devices.motor
Class TB6612FNGMotor
java.lang.Object
com.diozero.devices.motor.MotorBase
com.diozero.devices.motor.TB6612FNGMotor
- All Implemented Interfaces:
DeviceInterface
,FloatConsumer
,MotorInterface
,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.devices.motor.MotorBase
accept, addListener, removeListener, reverse, setValue, whenBackward, whenForward, whenStop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.diozero.api.function.FloatConsumer
andThen
-
Constructor Details
-
TB6612FNGMotor
public TB6612FNGMotor(DigitalOutputDevice motorForwardControlPin, DigitalOutputDevice motorBackwardControlPin, PwmOutputDevice motorPwmControl)
-
-
Method Details
-
close
public void close()Description copied from interface:DeviceInterface
Close this device -
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
-