Package edu.wpi.first.wpilibj.counter
Class ExternalDirectionCounter
java.lang.Object
edu.wpi.first.wpilibj.counter.ExternalDirectionCounter
- All Implemented Interfaces:
Sendable,AutoCloseable
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.
-
Constructor Summary
ConstructorsConstructorDescriptionExternalDirectionCounter(DigitalSource countSource, DigitalSource directionSource) Constructs a new ExternalDirectionCounter. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intgetCount()Gets the current count.voidinitSendable(SendableBuilder builder) Initializes thisSendableobject.voidreset()Resets the current count.voidsetEdgeConfiguration(EdgeConfiguration configuration) Sets the edge configuration for counting.voidsetReverseDirection(boolean reverseDirection) Sets to reverse the counter direction.
-
Constructor Details
-
ExternalDirectionCounter
Constructs a new ExternalDirectionCounter.- Parameters:
countSource- The source for counting.directionSource- The source for selecting count direction.
-
-
Method Details
-
getCount
Gets the current count.- Returns:
- The current count.
-
setReverseDirection
Sets to reverse the counter direction.- Parameters:
reverseDirection- True to reverse counting direction.
-
reset
Resets the current count. -
setEdgeConfiguration
Sets the edge configuration for counting.- Parameters:
configuration- The counting edge configuration.
-
close
- Specified by:
closein interfaceAutoCloseable
-
initSendable
Description copied from interface:SendableInitializes thisSendableobject.- Specified by:
initSendablein interfaceSendable- Parameters:
builder- sendable builder
-