Limit Switches

Reading a Digital Input

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
//import the DigitalInput Library
import com.wpi.first.wpilibj.DigitalInput;

//Create the DigitalInput Object
private DigitalInput input;

//Constuct a new instance
input = new DigitalInput(port);

//Can then use these accssor to get data
input.get(); //Will return true for a high signal and false for a low signal
1
2
3
4
5
6
7
8
//Include the DigitalInput Library
#include "frc/DigitalInput.h"

//Constructors
frc::DigitalInput input{port};

//Use these to access data
input.Get(); //Will return true for a high signal and false for a low signal