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
All Methods Static Methods Concrete Methods 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)
-
-
-
Method Detail
-
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
-
-