Class EdgeCounter

java.lang.Object
org.wpilib.hardware.counter.EdgeCounter
All Implemented Interfaces:
AutoCloseable, TelemetryLoggable

public class EdgeCounter extends Object implements TelemetryLoggable, AutoCloseable
Counts rising or falling edges on a single digital input.
  • Constructor Details

    • EdgeCounter

      public EdgeCounter(int channel, EdgeConfiguration configuration)
      Constructs a new edge counter.
      Parameters:
      channel - The DIO channel.
      configuration - The edge configuration.
  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • setEdgeConfiguration

      public void setEdgeConfiguration(EdgeConfiguration configuration)
      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

      public void logTo(TelemetryTable table)
      Description copied from interface: TelemetryLoggable
      Logs the object to a TelemetryTable.
      Specified by:
      logTo in interface TelemetryLoggable
      Parameters:
      table - telemetry table
    • getTelemetryType

      public String getTelemetryType()
      Description copied from interface: TelemetryLoggable
      Gets 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:
      getTelemetryType in interface TelemetryLoggable
      Returns:
      Table type