View Single Post
  #4   Spotlight this post!  
Unread 18-02-2013, 21:47
Negative 9 Negative 9 is offline
Registered User
FRC #0611
 
Join Date: Dec 2012
Location: Mclean, VA
Posts: 46
Negative 9 is an unknown quantity at this point
Re: How do you program limit switches?

Quote:
Originally Posted by shank948 View Post
Use a DigitalInput. It should be declared as a static variable, like this:

public static DigitalInput limitSwitch;

Initialize it like this:

limitSwitch = new DigitalInput(slot,channel);

To use the limit switch, call the get() method on it, which, assuming you have it wired correctly, will return true if the switch is closed and false if it is open.

Any more questions?
ok, so for the constructor. I pass the slot that it's plugged into on the DigitalIO for the slot, but what do I pass for channel?
Reply With Quote