Go to Post I have no clue. All I know is that every year the riddle in the clue has confused me but this year it is the lack of confusion that confuses me. - hallk [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #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
  #2   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
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:08.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi