|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Programming Limit Switch
I am the programmer for my team, and I am curious how to program a limit switch. I cant seem to find any documentation or code snippets elsewhere on the internet.
|
|
#2
|
||||
|
||||
|
Re: Programming Limit Switch
Initialize limit switches as a digital input:
Code:
DigitalInput switch = new DigitalInput(channel) Code:
if(switch.get()) doSomething(); |
|
#3
|
|||||
|
|||||
|
Re: Programming Limit Switch
What Signet said.
Also, if you ware using the Command Based structure with Java you can set the limit switch up to act as a button to fire a command. Code:
final DigitalInput limitSwitch = new DigitalInput(1);
Button limitSwitchButton = new Button() {
public boolean get() {
return limitSwitch.get();
}
};
limitSwitchButton.whenPressed(new SomethingCommand());
|
|
#4
|
||||
|
||||
|
Re: Programming Limit Switch
Quote:
So you just need: Code:
Button limitSwitchButton = new DigitalIOButton(1); limitSwitchButton.whenPressed(new limitSwitchCommand()); |
|
#5
|
|||||
|
|||||
|
Re: Programming Limit Switch
Even simpler.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|