View Single Post
  #1   Spotlight this post!  
Unread 30-01-2010, 18:42
RoboMaster's Avatar
RoboMaster RoboMaster is offline
Alum, former programmer&co-captain
FRC #2472 (The Centurions)
Team Role: Mentor
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Minnesota, Twin Cities
Posts: 268
RoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant futureRoboMaster has a brilliant future
Best way to check multiple Boolean values?

In your program you need to check which button out of a couple of buttons, say, on a joystick, is currently pressed. Depending on which one it is you return a different value. So basically checking which of the multiple boolean values is true. What are some ways to do this, specifically in LabVIEW?

There's always the old "check one, if false, check the next, repeat." (a whole bunch of if...else statements in C). But in LabVIEW this means putting a lot of Case structures within themselves, which is a major pain especially if there are a lot of values/buttons to check.

Is there maybe a way to put all the button values into an array, search for a true or 1, and return which index it was? I don't think there's a "search array" VI.
__________________
My engineering blog: noeticbrainwaves.blogspot.com

I'm not slacking, my code's compiling
...and I'm using LabVIEW
Reply With Quote