Package com.diozero.util
Class ServoUtil
java.lang.Object
com.diozero.util.ServoUtil
public class ServoUtil extends Object
-
Constructor Summary
Constructors Constructor Description ServoUtil()
-
Method Summary
Modifier and Type Method Description static double
calcPulseMsPerBit(int pwmFrequency, int range)
static int
calcServoPulseBits(double pulseWidthMs, double pulseMsPerBit)
static int
calcServoPulseBits(double pulseWidthMs, int pwmFrequency, int range)
Calculate the number of bits required for the specified pulse width (milliseconds)
-
Constructor Details
-
ServoUtil
public ServoUtil()
-
-
Method Details
-
calcPulseMsPerBit
public static double calcPulseMsPerBit(int pwmFrequency, int range) -
calcServoPulseBits
public static int calcServoPulseBits(double pulseWidthMs, double pulseMsPerBit) -
calcServoPulseBits
public static int calcServoPulseBits(double pulseWidthMs, int pwmFrequency, int range)Calculate the number of bits required for the specified pulse width (milliseconds)- Parameters:
pulseWidthMs
- The required pulse width valuepwmFrequency
- The servo driver PWM Frequencyrange
- The servo driver range, i.e. if 12 bit then this would be 4096- Returns:
- Relative servo driver duty cycle value required to set the requested pulse width
-