public class TetrixServo extends java.lang.Object implements Servo
The HiTechnic Servo Controller allows setting of the PWM output from 0.75 - 2.25ms. Note that some servos may hit their internal mechanical limits at each end of this range causing them to consume excessive current and potentially be damaged.
|Modifier and Type||Method and Description|
Returns the current servo angle as reverse calculated by the last call to
Get the current PWM pulse width for the servo.
Sets the angle target of the servo.
Set the PWM pulse width for the servo.
Set the allowable pulse width operating range of this servo in microseconds and the total travel range.
public void setRange(int microsecLOW, int microsecHIGH, int travelRange) throws java.lang.IllegalArgumentException
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 microseconds
microsecHIGH- The high end of the servos response/operating range in microseconds
travelRange- The total mechanical travel range of the servo in degrees
java.lang.IllegalArgumentException- if the range isn't within 750 and 2250
public void setAngle(float angle)
setRange()be called with the correct parameters to establish proper ranging conversion to internal controller representation of servo position.
public float getAngle()
setAngle(). This is calculated from the internal byte representation used (calculated by
setAngle()) to control the servo so the resolution will be affected by ranging factors set with
The actual physical servo position may or may not be at the reported angle if mechanical limits have been reached.
public void setpulseWidth(int microSeconds) throws java.lang.IllegalArgumentException
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.
The HiTechic Servo Controller allows setting of the PWM output from 750 to 2250 microseconds with a step resolution
of 5.88 microseconds (1 byte is used to control the pulse width output) and this method will calculate and use the stepped
value closest to value passed in
Note that some servos may hit their internal mechanical limits at each end of this range causing them to consume excessive current and potentially be damaged.