DutyCycle
- class wpilib.DutyCycle(source: SupportsInt | SupportsIndex)
Bases:
SendableClass to read a duty cycle PWM input.
PWM input signals are specified with a frequency and a ratio of high to low in that frequency. These can be attached to any SmartIO.
Constructs a DutyCycle input from a smartio channel.
- Parameters:
source – The channel to use.
- get_frequency() wpimath.units.hertz
Get the frequency of the duty cycle signal.
- Returns:
frequency
- get_high_time() wpimath.units.seconds
Get the raw high time of the duty cycle signal.
- Returns:
high time of last pulse
- get_output() float
Get the output ratio of the duty cycle signal.
0 means always low, 1 means always high.
- Returns:
output ratio between 0 and 1
- get_source_channel() int
Get the channel of the source.
- Returns:
the source channel