DigitalInput

class wpilib.DigitalInput(self: wpilib.DigitalInput, channel: int) → None

Bases: wpilib.DigitalSource, wpilib.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.

Create an instance of a Digital Input class.

Creates a digital input given a channel.

Parameters

channel – The DIO channel 0-9 are on-board, 10-25 are on the MXP port

get(self: wpilib.DigitalInput) → bool

Get the value from a digital input channel.

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

getAnalogTriggerTypeForRouting(self: wpilib.DigitalInput)wpilib.AnalogTriggerType
Returns

The type of analog trigger output to be used. 0 for Digitals

getChannel(self: wpilib.DigitalInput) → int
Returns

The GPIO channel number that this object represents.

getPortHandleForRouting(self: wpilib.DigitalInput) → int
Returns

The HAL Handle to the specified source.

initSendable(self: wpilib.DigitalInput, builder: wpilib.SendableBuilder) → None
isAnalogTrigger(self: wpilib.DigitalInput) → bool

Is source an AnalogTrigger

setSimDevice(self: wpilib.DigitalInput, device: int) → None

Indicates this input is used by a simulated device.

Parameters

device – simulated device handle