Package trclib.sensor

Class TrcDigitalInput

java.lang.Object
trclib.sensor.TrcDigitalInput
Direct Known Subclasses:
FtcDigitalInput, FtcTouchSensor, TrcMotorLimitSwitch

public abstract class TrcDigitalInput extends Object
This class implements a platform independent Digital Input device.
  • Field Details

    • moduleName

      private static final String moduleName
    • getInputElapsedTimer

      protected static TrcElapsedTimer getInputElapsedTimer
    • instanceName

      protected final String instanceName
    • inverted

      private boolean inverted
  • Constructor Details

    • TrcDigitalInput

      public TrcDigitalInput(String instanceName)
      Constructor: Create an instance of the object.
      Parameters:
      instanceName - specifies the instance name.
  • Method Details

    • getInputState

      public abstract boolean getInputState()
      This method is provided by the platform dependent digital input device to check the state of the input.
      Returns:
      true if the digital input is active, false otherwise.
    • toString

      public String toString()
      This method returns the instance name.
      Overrides:
      toString in class Object
      Returns:
      instance name.
    • setInverted

      public void setInverted(boolean inverted)
      This method inverts the digital input state. It is useful for changing a limit switch from Normal Open to Normal Close, for example.
      Parameters:
      inverted - specifies true to invert the digital input, false otherwise.
    • isActive

      public boolean isActive()
      This method returns the state of the input device.
      Returns:
      true if active, false otherwise.
    • setElapsedTimerEnabled

      public static void setElapsedTimerEnabled(boolean enabled)
      This method enables/disables the elapsed timers for performance monitoring.
      Parameters:
      enabled - specifies true to enable elapsed timers, false to disable.
    • printElapsedTime

      public static void printElapsedTime(TrcDbgTrace tracer)
      This method prints the elapsed time info using the given tracer.
      Parameters:
      tracer - specifies the tracer to be used to print the info.