View Single Post
  #6   Spotlight this post!  
Unread 12-02-2015, 21:12
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
Re: Industrial switch

Quote:
Originally Posted by SousVide View Post
I hope that I didn't deviate too much off the thread. Is this about the NC wired switch ? not sure if this was something else in the thread that could be a software change ...

How would a software solution work to detect a open-wire condition in a normally NO switch ?
Just see what the roboRIO reports back.

If the switch is normally closed:

if (!getSwitch()) //This will happen when the switch opens
{
Do stuff
}


If the switch is normally open
if(getSwitch () ) //This will happen when the switch closes
{
Do stuff
}

Obviously this is not the correct function call, but just an example of how you would code it. (I am assuming that when the switch is closed, the function will return TRUE. If it's the other way around, switch my code...)

Edit: I assumed incorrectly. According to the documentation that GeeTwo linked to, when the switch is OPEN, the value is 1, when it is CLOSED the value is 0.
__________________
1771- Programmer, Captain, Drive Team (2009-2012)
4509- Mentor (2013-2015)
1771- Mentor (2015)

Last edited by nighterfighter : 13-02-2015 at 00:28.