|
Re: Programming Limit Switch
Quote:
Originally Posted by notmattlythgoe
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());
|
Actually there is already a class for this in WPILib: DigitalIOButton.
So you just need:
Code:
Button limitSwitchButton = new DigitalIOButton(1);
limitSwitchButton.whenPressed(new limitSwitchCommand());
__________________
 Programmer - A creature known for converting Caffeine into Code.
Studying Computer Science @ Louisiana Tech University
Associate Consultant @ Fenway Group
2012-13: 3946 - Head of Programming, Electrical and Web
2014 - 3468 - Programming Mentor
2015 - Present - Lurker
|