public class Servo extends GpioDevice implements OutputDeviceInterface
Modifier and Type | Class and Description |
---|---|
static class |
Servo.Array |
static class |
Servo.OutputDeviceUnit |
static class |
Servo.Trim |
gpio
Constructor and Description |
---|
Servo(int gpio,
float initialPulseWidthMs) |
Servo(int gpio,
float initialPulseWidthMs,
int pwmFrequency) |
Servo(int gpio,
float initialPulseWidthMs,
int pwmFrequency,
Servo.Trim trim) |
Servo(int gpio,
float initialPulseWidthMs,
Servo.Trim trim) |
Servo(PwmOutputDeviceFactoryInterface pwmDeviceFactory,
int gpio,
float initialPulseWidthMs,
int pwmFrequency) |
Servo(PwmOutputDeviceFactoryInterface pwmDeviceFactory,
int gpio,
float initialPulseWidthMs,
int pwmFrequency,
Servo.Trim trim) |
Modifier and Type | Method and Description |
---|---|
void |
centre() |
void |
close() |
float |
getAngle()
Get the current servo angle where 90 degrees is the middle position
|
Servo.OutputDeviceUnit |
getOutputDeviceUnit() |
float |
getPulseWidthMs()
Get the current servo pulse width in milliseconds
|
int |
getPwmFrequency() |
float |
getValue() |
void |
max() |
void |
min() |
void |
setAngle(float angle)
Turn the servo to the specified angle where 90 is the middle position
|
Servo |
setInverted(boolean inverted) |
Servo |
setOutputDeviceUnit(Servo.OutputDeviceUnit outputDeviceUnit) |
void |
setPulseWidthMs(float pulseWidthMs)
Set the servo pulse width in milliseconds
|
void |
setValue(float value) |
getGpio
public Servo(int gpio, float initialPulseWidthMs) throws RuntimeIOException
RuntimeIOException
public Servo(int gpio, float initialPulseWidthMs, Servo.Trim trim) throws RuntimeIOException
RuntimeIOException
public Servo(int gpio, float initialPulseWidthMs, int pwmFrequency) throws RuntimeIOException
RuntimeIOException
public Servo(int gpio, float initialPulseWidthMs, int pwmFrequency, Servo.Trim trim) throws RuntimeIOException
RuntimeIOException
public Servo(PwmOutputDeviceFactoryInterface pwmDeviceFactory, int gpio, float initialPulseWidthMs, int pwmFrequency) throws RuntimeIOException
RuntimeIOException
public Servo(PwmOutputDeviceFactoryInterface pwmDeviceFactory, int gpio, float initialPulseWidthMs, int pwmFrequency, Servo.Trim trim) throws RuntimeIOException
RuntimeIOException
public Servo.OutputDeviceUnit getOutputDeviceUnit()
public Servo setOutputDeviceUnit(Servo.OutputDeviceUnit outputDeviceUnit)
public Servo setInverted(boolean inverted)
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public int getPwmFrequency()
public float getValue()
public void setValue(float value)
setValue
in interface OutputDeviceInterface
public float getPulseWidthMs()
public void setPulseWidthMs(float pulseWidthMs)
pulseWidthMs
- Servo pulse width (milliseconds)public float getAngle()
public void setAngle(float angle)
angle
- Servo angle (90 degrees is middle)public void min()
public void max()
public void centre()
Copyright © 2016–2018 mattjlewis. All rights reserved.