Class DigitalInputDevice

java.lang.Object
com.cdarobotics.cdalib.devices.Device
com.cdarobotics.cdalib.devices.sensors.DigitalInputDevice

public class DigitalInputDevice extends Device
A Device wrapping a DigitalChannel configured as an input (e.g. a limit switch or magnetic sensor). The channel is read once per update() and cached.

Getters reflect the value from the most recent update().

  • Constructor Summary

    Constructors
    Constructor
    Description
    DigitalInputDevice(com.qualcomm.robotcore.hardware.DigitalChannel channel)
    Wraps an already-resolved digital channel and puts it in input mode.
    DigitalInputDevice(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String name)
    Resolves the digital channel from the hardware map by configured name.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.qualcomm.robotcore.hardware.DigitalChannel
     
    boolean
     
    void
    Flush pending writes to, or refresh cached reads from, the underlying hardware.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DigitalInputDevice

      public DigitalInputDevice(com.qualcomm.robotcore.hardware.DigitalChannel channel)
      Wraps an already-resolved digital channel and puts it in input mode.
    • DigitalInputDevice

      public DigitalInputDevice(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String name)
      Resolves the digital channel from the hardware map by configured name.
  • Method Details

    • getState

      public boolean getState()
      Returns:
      the channel state as of the last update().
    • getChannel

      public com.qualcomm.robotcore.hardware.DigitalChannel getChannel()
      Returns:
      the wrapped SDK channel, for operations not exposed here.
    • update

      public void update()
      Description copied from class: Device
      Flush pending writes to, or refresh cached reads from, the underlying hardware.
      Specified by:
      update in class Device