Package com.diozero.api.motor
Class DigitalMotor
java.lang.Object
com.diozero.api.motor.DigitalMotor
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class DigitalMotor
extends java.lang.Object
implements java.io.Closeable
-
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()- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
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
-