Package edu.wpi.first.wpilibj
Class DigitalInput
java.lang.Object
edu.wpi.first.wpilibj.DigitalSource
edu.wpi.first.wpilibj.DigitalInput
- All Implemented Interfaces:
- Sendable,- AutoCloseable
public class DigitalInput extends DigitalSource implements Sendable
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.
- 
Constructor SummaryConstructors Constructor Description DigitalInput(int channel)Create an instance of a Digital Input class.
- 
Method SummaryModifier and Type Method Description voidclose()booleanget()Get the value from a digital input channel.intgetAnalogTriggerTypeForRouting()Get the analog trigger type.intgetChannel()Get the channel of the digital input.intgetPortHandleForRouting()Get the HAL Port Handle.voidinitSendable(SendableBuilder builder)Initializes thisSendableobject.booleanisAnalogTrigger()Is this an analog trigger.voidsetSimDevice(SimDevice device)Indicates this input is used by a simulated device.
- 
Constructor Details- 
DigitalInputCreate an instance of a Digital Input class. Creates a digital input given a channel.- Parameters:
- channel- the DIO channel for the digital input 0-9 are on-board, 10-25 are on the MXP
 
 
- 
- 
Method Details- 
close- Specified by:
- closein interface- AutoCloseable
- Overrides:
- closein class- DigitalSource
 
- 
getGet the value from a digital input channel. Retrieve the value of a single digital input channel from the FPGA.- Returns:
- the status of the digital input
 
- 
getChannelGet the channel of the digital input.- Specified by:
- getChannelin class- DigitalSource
- Returns:
- The GPIO channel number that this object represents.
 
- 
getAnalogTriggerTypeForRoutingGet the analog trigger type.- Specified by:
- getAnalogTriggerTypeForRoutingin class- DigitalSource
- Returns:
- false
 
- 
isAnalogTriggerIs this an analog trigger.- Specified by:
- isAnalogTriggerin class- DigitalSource
- Returns:
- true if this is an analog trigger
 
- 
getPortHandleForRoutingGet the HAL Port Handle.- Specified by:
- getPortHandleForRoutingin class- DigitalSource
- Returns:
- The HAL Handle to the specified source.
 
- 
setSimDeviceIndicates this input is used by a simulated device.- Parameters:
- device- simulated device handle
 
- 
initSendableDescription copied from interface:SendableInitializes thisSendableobject.- Specified by:
- initSendablein interface- Sendable
- Parameters:
- builder- sendable builder
 
 
-