View Single Post
  #11   Spotlight this post!  
Unread 19-02-2013, 01:44
arithehun arithehun is offline
Registered User
AKA: Ari Falkner
FRC #3024
Team Role: Programmer
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Ashland, Oregon
Posts: 27
arithehun is an unknown quantity at this point
Re: How do you program limit switches?

For some of you using command based programming, I noticed that the DigitalIOButton class wasn't working properly, so I programmed my own DigitalButton class using the very-functional DigitalInput class.

Code:
public class DigitalButton extends Button {
    private int channel;
    DigitalInput buttonInput;
    
    public DigitalButton(int channel) {
        this.channel = channel;
        buttonInput = new DigitalInput(channel);
    }

    public int getChannel() {
        return this.channel;
    }
    
    public boolean get() {
        return buttonInput.get();
    }
    
}
Reply With Quote