public class GenericServo extends ComponentBase implements Servo
| Modifier and Type | Class and Description |
|---|---|
static class |
GenericServo.Orientation |
| Modifier and Type | Field and Description |
|---|---|
static float |
PWM_MAX |
static float |
PWM_MIN |
static float |
PWM_NEUTRAL |
END_POINT_MAX, END_POINT_MIN, POS_MAX_LEFT, POS_MAX_RIGHT, POS_NEUTRAL, PROP_END_POINT_DEFAULT, PROP_END_POINT_LEFT, PROP_END_POINT_RIGHT, PROP_IS_REVERSE, PROP_IS_REVERSE_DEFAULT, PROP_SUBTRIM, PROP_SUBTRIM_DEFAULT, SUBTRIM_MAX_LEFT, SUBTRIM_MAX_RIGHT, SUBTRIM_NEUTRAL| Constructor and Description |
|---|
GenericServo(ServoDriver servoDriver,
String name) |
GenericServo(ServoDriver servoDriver,
String name,
Map<String,String> properties) |
| Modifier and Type | Method and Description |
|---|---|
float |
getPosition() |
protected int |
getPwmDuration() |
ServoDriver |
getServoDriver()
Returns servo driver this servo is attached to
|
protected void |
init() |
void |
off()
Make the servo passive.
|
void |
setPosition(float position)
Sets the servos desired position by providing a percentage value.
|
void |
setProperty(String key,
String value) |
protected void |
setServoDriver(ServoDriver servoDriver) |
String |
toString() |
clearProperties, getName, getProperties, getProperty, getProperty, getTag, hasProperty, removeProperty, setName, setTagclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclearProperties, getName, getProperties, getProperty, getProperty, getTag, hasProperty, removeProperty, setName, setTagpublic static final float PWM_MIN
public static final float PWM_NEUTRAL
public static final float PWM_MAX
public GenericServo(ServoDriver servoDriver, String name)
public GenericServo(ServoDriver servoDriver, String name, Map<String,String> properties)
protected void setServoDriver(ServoDriver servoDriver)
public ServoDriver getServoDriver()
ServogetServoDriver in interface Servopublic void setPosition(float position)
Servo
E.g.: a position value of -100 would force the servo to travel to its max. left position as defined in
property Servo.PROP_END_POINT_LEFT.
setPosition in interface Servoposition - value between -100 and +100 according to Servo.POS_MAX_LEFT respectively Servo.POS_MAX_RIGHT.public float getPosition()
getPosition in interface Servopublic void off()
Servoprotected int getPwmDuration()
public void setProperty(String key, String value)
setProperty in interface ComponentsetProperty in class ComponentBaseprotected void init()
Copyright © 2012–2019 Pi4J. All rights reserved.