public class PwmMotor extends MotorBase
Constructor and Description |
---|
PwmMotor(int forwardPwmGpio,
int backwardPwmGpio) |
PwmMotor(PwmOutputDeviceFactoryInterface deviceFactory,
int forwardPwmGpio,
int backwardPwmGpio) |
Modifier and Type | Method and Description |
---|---|
void |
backward()
Backward at full speed
|
void |
backward(float speed) |
void |
close() |
void |
forward()
Forward at full speed
|
void |
forward(float speed) |
float |
getValue()
Represents the speed of the motor as a floating point value between -1
(full speed backward) and 1 (full speed forward).
|
boolean |
isActive() |
void |
stop() |
addListener, removeListener, reverse, setValue, valueChanged, whenBackward, whenForward, whenStop
public PwmMotor(int forwardPwmGpio, int backwardPwmGpio) throws RuntimeIOException
RuntimeIOException
public PwmMotor(PwmOutputDeviceFactoryInterface deviceFactory, int forwardPwmGpio, int backwardPwmGpio) throws RuntimeIOException
RuntimeIOException
public void close()
public void forward() throws RuntimeIOException
RuntimeIOException
- if an I/O error occurspublic void forward(float speed) throws RuntimeIOException
speed
- Range 0..1RuntimeIOException
- if an I/O error occurspublic void backward() throws RuntimeIOException
RuntimeIOException
- if an I/O error occurspublic void backward(float speed) throws RuntimeIOException
speed
- Range 0..1RuntimeIOException
- if an I/O error occurspublic void stop() throws RuntimeIOException
RuntimeIOException
public float getValue() throws RuntimeIOException
RuntimeIOException
- if an I/O error occurspublic boolean isActive() throws RuntimeIOException
RuntimeIOException
Copyright © 2016–2017 mattjlewis. All rights reserved.