Package com.diozero.devices.motor
Class DigitalMotor
java.lang.Object
com.diozero.devices.motor.DigitalMotor
- All Implemented Interfaces:
DeviceInterface
,AutoCloseable
public class DigitalMotor extends Object implements DeviceInterface
-
Constructor Summary
Constructors Constructor Description DigitalMotor(int forwardGpio, int backwardGpio)
DigitalMotor(GpioDeviceFactoryInterface deviceFactory, int forwardGpio, int backwardGpio)
-
Method Summary
-
Constructor Details
-
DigitalMotor
- Throws:
RuntimeIOException
-
DigitalMotor
public DigitalMotor(GpioDeviceFactoryInterface deviceFactory, int forwardGpio, int backwardGpio) throws RuntimeIOException- Throws:
RuntimeIOException
-
-
Method Details
-
close
public void close()Description copied from interface:DeviceInterface
Close this device- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceDeviceInterface
-
forward
- Throws:
RuntimeIOException
-
backward
- Throws:
RuntimeIOException
-
stop
- Throws:
RuntimeIOException
-
reverse
- Throws:
RuntimeIOException
-
isActive
- Throws:
RuntimeIOException
-
getValue
Represents the speed of the motor as a floating point value between -1 (full speed backward) and 1 (full speed forward)- Returns:
- current value for this motor in the range -1 (backwards) to 1 (forwards)
- Throws:
RuntimeIOException
- if an I/O error occurs
-