π»Software
Python
class wpilib.DigitalInput(channel: int)
Bases: DigitalSource, 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()β bool
Get the value from a digital input channel.
Retrieve the value of a single digital input channel from the FPGA.
Java
// Initializes a DigitalInput on DIO 0
DigitalInput input = new DigitalInput(0);
// Gets the value of the digital input. Returns true if the circuit is open.
input.get();
C++
//Initializes a DigitalInput on DIO 0
frc::DigitalInput input{0};
// Gets the value of the digital input. Returns true if the circuit is open.
input.Get();
For more information, please see the WPILIB Repository.
Last updated