Log in

View Full Version : Programming Limit Switch


Mr.Roboto3335
24-02-2013, 15:30
I have no idea how to program a limit switch. If anyone could give me an example or link on how to program one it would be appreciated.

F22Rapture
24-02-2013, 16:56
I have no idea how to program a limit switch. If anyone could give me an example or link on how to program one it would be appreciated.

What are you doing with it?

Here's the basic code:

DigitalInput limitSwitch;

public RandomSubsystem() {

limitSwitch = new DigitalInput(1); //1 = the DIO port of the sensor
}

public boolean getLimitSwitch() {
return limitSwitch.get();
}

public void doSomething() {
if(getLimitSwitch() == false) {
doSomething();
}
}


Then call doSomething() from a command and set the isFinished() method to trigger when getLimitSwitch() returns true.

Ether
24-02-2013, 18:26
I have no idea how to program a limit switch. If anyone could give me an example or link on how to program one it would be appreciated.

FWIW, if you plug it directly into a Jag you don't need to program it.