View Single Post
  #1   Spotlight this post!  
Unread 18-02-2013, 21:38
shank948 shank948 is offline
VP of Programming - 948
AKA: Stephen Shank
FRC #0948 (NRG (Newport Robotics Group))
Team Role: Alumni
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Bellevue, Wa
Posts: 21
shank948 is an unknown quantity at this point
Re: How do you program limit switches?

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?
__________________
If it's green and slimy, it's Biology.
If it smells, it's Chemistry.
If it doesn't work, it's Physics.
- My Physics Teacher

Fixed:
If it doesn't work, it's our Robot up until that last few days of the build season.
Reply With Quote