Class EdgeCounter
java.lang.Object
org.wpilib.hardware.counter.EdgeCounter
- All Implemented Interfaces:
AutoCloseable, TelemetryLoggable
Counts rising or falling edges on a single digital input.
-
Constructor Summary
ConstructorsConstructorDescriptionEdgeCounter(int channel, EdgeConfiguration configuration) Constructs a new edge counter. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intgetCount()Gets the current count.Gets the telemetry table type.voidlogTo(TelemetryTable table) Logs the object to aTelemetryTable.final voidreset()Resets the current count.voidsetEdgeConfiguration(EdgeConfiguration configuration) Sets which edge of the digital input is counted.
-
Constructor Details
-
EdgeCounter
Constructs a new edge counter.- Parameters:
channel- The DIO channel.configuration- The edge configuration.
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
setEdgeConfiguration
Sets which edge of the digital input is counted.- Parameters:
configuration- The edge configuration.
-
reset
public final void reset()Resets the current count. -
getCount
public int getCount()Gets the current count.- Returns:
- The current count.
-
logTo
Description copied from interface:TelemetryLoggableLogs the object to aTelemetryTable.- Specified by:
logToin interfaceTelemetryLoggable- Parameters:
table- telemetry table
-
getTelemetryType
Description copied from interface:TelemetryLoggableGets the telemetry table type. Default is no specified table type (null). A mismatch in type during logging results in a reported warning, so this should always return the same value.- Specified by:
getTelemetryTypein interfaceTelemetryLoggable- Returns:
- Table type
-