Java Device I/O library that is portable across Single Board Computers and microcontrollers. Tested with Raspberry Pi, Odroid C2, BeagleBone Black, Next Thing CHIP, Asus Tinker Board and Arduinos / Pico. Supports GPIO, I2C, SPI as well as Serial communication. Also known to work with Udoo Quad.
public DigitalMotor(GpioDeviceFactoryInterface deviceFactory, int forwardGpio, int backwardGpio) throws RuntimeIOException {
forward = new DigitalOutputDevice(deviceFactory, forwardGpio, true, false);
backward = new DigitalOutputDevice(deviceFactory, forwardGpio, true, false);
}
Constructor of DigitalMotor looks as:
backward should be initialized with backwardGpio