public interface Servo
Modifier and Type | Method and Description |
---|---|
float |
getAngle()
Gets the rotational position (angle) of a ranged servo.
|
int |
getpulseWidth()
Get the current PWM pulse width for the servo.
|
void |
setAngle(float angle)
Sets the rotational position (angle) of a ranged servo.
|
void |
setpulseWidth(int microSeconds)
Set the PWM pulse width for the servo.
|
void |
setRange(int microsecLOW,
int microsecHIGH,
int travelRange)
Set the allowable pulse width operating range of this servo in microseconds and the total travel range to allow
the use of angle-based parameters to control the servo.
|
void setAngle(float angle)
angle
- the target angle in degreesgetAngle()
,
setRange(int, int, int)
float getAngle()
setAngle(float)
void setpulseWidth(int microSeconds)
A servo pulse of 1500 microseconds (1.5 ms) width will typically set the servo to its "neutral" position. This is the "standard pulse servo mode" used by all hobby analog servos.
microSeconds
- The pulse width time in microsecondsint getpulseWidth()
void setRange(int microsecLOW, int microsecHIGH, int travelRange)
This information
is used to calculate ansolute angles used by the setAngle()
and getAngle()
methods.
The midpoint
of the pulse width operating range should normally be 1500 microseconds so the range extents should reflect this.
This information must reflect the appropriate specifications and/or empirical characterization data of the specific
servo used for the setAngle()
method to be able to position the servo accurately.
microsecLOW
- The low end of the servos response/operating range in microsecondsmicrosecHIGH
- The high end of the servos response/operating range in microsecondstravelRange
- The total mechanical travel range of the servo in degreessetAngle(float)