|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Programming Limit Switch
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.
|
|
#2
|
||||
|
||||
|
Re: Programming Limit Switch
Quote:
Here's the basic code: 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. |
|
#3
|
||||
|
||||
|
Re: Programming Limit Switch
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|