Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.wpi.first.wpilibj
Class DigitalInput

    java.lang.Object
      edu.wpi.first.wpilibj.SensorBase
          edu.wpi.first.wpilibj.InterruptableSensorBase
              edu.wpi.first.wpilibj.DigitalSource
                  edu.wpi.first.wpilibj.DigitalInput

All Implemented Interfaces:
  LiveWindowSendable, IDevice, IInputOutput, Sendable

    public class DigitalInput

extends DigitalSource
implements IInputOutput, LiveWindowSendable

Class to read a digital input. This class will read digital inputs and return the current value on the channel. Other devices such as encoders, gear tooth sensors, etc. that are implemented elsewhere will automatically allocate digital inputs and outputs as required. This class is only for devices like switches etc. that aren't implemented anywhere else.

Field Summary

Fields inherited from class edu.wpi.first.wpilibj.InterruptableSensorBase
`interrupts, m_interrupt, m_interruptIndex, m_manager`

Fields inherited from class edu.wpi.first.wpilibj.SensorBase
`kAnalogChannels, kAnalogModules, kDigitalChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond`

Constructor Summary
`DigitalInput(int channel)` Create an instance of a Digital Input class.
`DigitalInput(int moduleNumber, int channel)` Create an instance of a Digital Input class.

Method Summary
`void` | `free()` Free the resources used by this object
`boolean` | `get()` Get the value from a digital input channel.
`boolean` | `getAnalogTriggerForRouting()` Is this an analog trigger
`int` | `getChannel()` Get the channel of the digital input
`int` | `getChannelForRouting()` Get the channel routing number
`int` | `getModuleForRouting()` Get the module routing number
`String` | `getSmartDashboardType()`
`ITable` | `getTable()`
`void` | `initTable(ITable subtable)` Initializes a table for this sendable object.
`void` | `requestInterrupts()` Request interrupts synchronously on this digital input.
`void` | `requestInterrupts(Object handler, Object param)` Request interrupts asynchronously on this digital input.
`void` | `setUpSourceEdge(boolean risingEdge, boolean fallingEdge)` Set which edge to trigger interrupts on
`void` | `startLiveWindowMode()` Start having this sendable object automatically respond to value changes reflect the value on the table.
`void` | `stopLiveWindowMode()` Stop having this sendable object automatically respond to value changes.
`void` | `updateTable()` Update the table for this sendable object with the latest values.

Methods inherited from class edu.wpi.first.wpilibj.InterruptableSensorBase
`allocateInterrupts, cancelInterrupts, disableInterrupts, enableInterrupts, readInterruptTimestamp, waitForInterrupt`

Methods inherited from class edu.wpi.first.wpilibj.SensorBase
`checkAnalogChannel, checkAnalogModule, checkDigitalChannel, checkDigitalModule, checkPWMChannel, checkPWMModule, checkRelayChannel, checkRelayModule, checkSolenoidChannel, checkSolenoidModule, getDefaultAnalogModule, getDefaultDigitalModule, getDefaultSolenoidModule, setDefaultAnalogModule, setDefaultDigitalModule, setDefaultSolenoidModule`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DigitalInput

    public DigitalInput(int channel)

  Create an instance of a Digital Input class. Creates a digital input given a channel and uses the default module.

  Parameters:
    `channel` - the port for the digital input

### DigitalInput

    public DigitalInput(int moduleNumber,
                        int channel)

  Create an instance of a Digital Input class. Creates a digital input given an channel and module.

  Parameters:
    `moduleNumber` - The number of the digital module to use for this input
    `channel` - the port for the digital input

Method Detail

### free

    public void free()

  Description copied from class: `SensorBase`
  Free the resources used by this object

  Overrides:
    `free` in class `SensorBase`

### get

    public boolean get()

  Get the value from a digital input channel. Retrieve the value of a single digital input channel from the FPGA.

  Returns:
    the stats of the digital input

### getChannel

    public int getChannel()

  Get the channel of the digital input

  Returns:
    The GPIO channel number that this object represents.

### getChannelForRouting

    public int getChannelForRouting()

  Description copied from class: `DigitalSource`
  Get the channel routing number

  Specified by:
    `getChannelForRouting` in class `DigitalSource`
  Returns:
    channel routing number

### getModuleForRouting

    public int getModuleForRouting()

  Description copied from class: `DigitalSource`
  Get the module routing number

  Specified by:
    `getModuleForRouting` in class `DigitalSource`
  Returns:
    module routing number

### getAnalogTriggerForRouting

    public boolean getAnalogTriggerForRouting()

  Description copied from class: `DigitalSource`
  Is this an analog trigger

  Specified by:
    `getAnalogTriggerForRouting` in class `DigitalSource`
  Returns:
    true if this is an analog trigger

### requestInterrupts

    public void requestInterrupts(Object handler,
                                  Object param)

  Request interrupts asynchronously on this digital input.

  Parameters:
    `handler` - The address of the interrupt handler function of type tInterruptHandler that will be called whenever there is an interrupt on the digitial input port. Request interrupts in synchronus mode where the user program interrupt handler will be called when an interrupt occurs. The default is interrupt on rising edges only.
    `param` - argument to pass to the handler

### requestInterrupts

    public void requestInterrupts()

  Request interrupts synchronously on this digital input. Request interrupts in synchronus mode where the user program will have to explicitly wait for the interrupt to occur. The default is interrupt on rising edges only.

### setUpSourceEdge

    public void setUpSourceEdge(boolean risingEdge,
                                boolean fallingEdge)

  Set which edge to trigger interrupts on

  Parameters:
    `risingEdge` - true to interrupt on rising edge
    `fallingEdge` - true to interrupt on falling edge

### getSmartDashboardType

    public String getSmartDashboardType()

  Specified by:
    `getSmartDashboardType` in interface `Sendable`
  Returns:
    the string representation of the named data type that will be used by the smart dashboard for this sendable

### initTable

    public void initTable(ITable subtable)

  Initializes a table for this sendable object.

  Specified by:
    `initTable` in interface `Sendable`
  Parameters:
    `subtable` - The table to put the values in.

### updateTable

    public void updateTable()

  Update the table for this sendable object with the latest values.

  Specified by:
    `updateTable` in interface `LiveWindowSendable`

### getTable

    public ITable getTable()

  Specified by:
    `getTable` in interface `Sendable`
  Returns:
    the table that is currently associated with the sendable

### startLiveWindowMode

    public void startLiveWindowMode()

  Start having this sendable object automatically respond to value changes reflect the value on the table.

  Specified by:
    `startLiveWindowMode` in interface `LiveWindowSendable`

### stopLiveWindowMode

    public void stopLiveWindowMode()

  Stop having this sendable object automatically respond to value changes.

  Specified by:
    `stopLiveWindowMode` in interface `LiveWindowSendable`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

"
For updated information see the Java FRC site
"