UpDownCounter¶
- class wpilib.counter.UpDownCounter(*args, **kwargs)¶
Bases:
Sendable
Up Down Counter.
This class can count edges on a single digital input or count up based on an edge from one digital input and down on an edge from another digital input.
Overloaded function.
__init__(self: wpilib.counter._counter.UpDownCounter, upSource: wpilib._wpilib.DigitalSource, downSource: wpilib._wpilib.DigitalSource) -> None
Constructs a new UpDown Counter.
- Parameters:
upSource – The up count source (can be null).
downSource – The down count source (can be null).
__init__(self: wpilib.counter._counter.UpDownCounter, upSource: wpilib._wpilib.DigitalSource, downSource: wpilib._wpilib.DigitalSource) -> None
Constructs a new UpDown Counter.
- Parameters:
upSource – The up count source (can be null).
downSource – The down count source (can be null).
- getCount() int ¶
Gets the current count.
- Returns:
The current count.
- reset() None ¶
Resets the current count.
- setDownEdgeConfiguration(configuration: wpilib.counter._counter.EdgeConfiguration) None ¶
Sets the configuration for the down source.
- Parameters:
configuration – The down source configuration.
- setReverseDirection(reverseDirection: bool) None ¶
Sets to revert the counter direction.
- Parameters:
reverseDirection – True to reverse counting direction.
- setUpEdgeConfiguration(configuration: wpilib.counter._counter.EdgeConfiguration) None ¶
Sets the configuration for the up source.
- Parameters:
configuration – The up source configuration.