ExternalDirectionCounter

class wpilib.counter.ExternalDirectionCounter(*args, **kwargs)

Bases: Sendable

Counter using external direction.

This counts on an edge from one digital input and the whether it counts up or down based on the state of a second digital input.

Overloaded function.

  1. __init__(self: wpilib.counter._counter.ExternalDirectionCounter, countSource: wpilib._wpilib.DigitalSource, directionSource: wpilib._wpilib.DigitalSource) -> None

Constructs a new ExternalDirectionCounter.

Parameters:
  • countSource – The source for counting.

  • directionSource – The source for selecting count direction.

  1. __init__(self: wpilib.counter._counter.ExternalDirectionCounter, countSource: wpilib._wpilib.DigitalSource, directionSource: wpilib._wpilib.DigitalSource) -> None

Constructs a new ExternalDirectionCounter.

Parameters:
  • countSource – The source for counting.

  • directionSource – The source for selecting count direction.

getCount() int

Gets the current count.

Returns:

The current count.

reset() None

Resets the current count.

setEdgeConfiguration(configuration: wpilib.counter._counter.EdgeConfiguration) None

Sets the edge configuration for counting.

Parameters:

configuration – The counting edge configuration.

setReverseDirection(reverseDirection: bool) None

Sets to reverse the counter direction.

Parameters:

reverseDirection – True to reverse counting direction.