03-07-2010 06:03 PM
Hi all,
I am currently working on a Vi for a class project. I am using a joystick to interface with the Vi. It is basically a simulation of a vehicle with a speedo and rpm gauge that needs to shift up through the gears which are indicated by the LED's with one button and downshift with a different button. As the upshift button is pressed it turns on led and keeps it on. The I would like it to turn off led one and turn on led two when pressed again up to 5. The opposite for downshifting with a seperate button. I have gotten as far as to be able to latch in one led. I have made a small vi for just the led sequence part of it to post. It will however run in the while loop with all the other code once i have figured this out.
I would greatly appreciate any guidance or tips anyone has. Thanks in advance.
Running labview 8.6 and winxp
03-07-2010 07:35 PM
I'm still hoping that there is a way to do it with just one button. In the meantime I have been working with using a different button for each led and latching it in even after the button reads false.
03-07-2010 08:33 PM
Instead of working with complicated boolean logic, store your current gear in a shift register as a number. If the up button is pressed, it increments the value. If the down button is pressed, it decrements the value.
Now turn your booleans into a boolean array. Use the value of the shift register to determine which index value of the boolean array to turn on (and all the others would be off.)
03-07-2010 10:02 PM