Package edu.wpi.first.wpilibj.counter
Class UpDownCounter
java.lang.Object
edu.wpi.first.wpilibj.counter.UpDownCounter
- All Implemented Interfaces:
Sendable
,AutoCloseable
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.
-
Constructor Summary
ConstructorsConstructorDescriptionUpDownCounter
(int channel, EdgeConfiguration configuration) Constructs a new UpDown Counter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
int
getCount()
Gets the current count.void
initSendable
(SendableBuilder builder) Initializes thisSendable
object.final void
reset()
Resets the current count.void
setEdgeConfiguration
(EdgeConfiguration configuration) Sets the configuration for the up source.
-
Constructor Details
-
UpDownCounter
Constructs a new UpDown Counter.- Parameters:
channel
- The up count source (can be null).configuration
- The edge configuration.
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
-
setEdgeConfiguration
Sets the configuration for the up source.- Parameters:
configuration
- The up source configuration.
-
reset
Resets the current count. -
getCount
Gets the current count.- Returns:
- The current count.
-
initSendable
Description copied from interface:Sendable
Initializes thisSendable
object.- Specified by:
initSendable
in interfaceSendable
- Parameters:
builder
- sendable builder
-