DigitalInput

class wpilib.DigitalInput(channel)[source]

Bases: wpilib.DigitalSource

Reads 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.

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

Parameters:channel (int) – the DIO channel for the digital input. 0-9 are on-board, 10-25 are on the MXP
free()[source]
get()[source]

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

Returns:the state of the digital input
Return type:bool
getAnalogTriggerTypeForRouting()[source]

Get the analog trigger type.

Returns:false
Return type:int
getChannel()[source]

Get the channel of the digital input.

Returns:The GPIO channel number that this object represents.
Return type:int
getPortHandleForRouting()[source]

Get the HAL Port Handle.

Returns:The HAL Handle to the specified source
isAnalogTrigger()[source]

Is this an analog trigger.

Returns:true if this is an analog trigger
Return type:bool