Log in

View Full Version : [FTC]: A useful VI I created


MattSr
19-11-2009, 23:56
Here is a subVI I created that i thought would help out anyone using labVIEW

I created it to be used to take the 12 boolean wires outputted from "FTC Read Controller.vi" and convert them from 12 true/false variables, to a binary number, to a base 10 number that you can connect to a case statement to do things such as stop when no buttons are being pressed or do an action when a certain combination of buttons is pressed. It comes with a small guide to help you understand how it is getting its output number and ultimately avoid a lot of unnecessary programming.

Button Config Outputs:

Controller Button - Binary Output - Base 10 Output

1 - 000000000001 - 1
2 - 000000000010 - 2
3 - 000000000100 - 4
4 - 000000001000 - 8
5 - 000000010000 - 16
6 - 000000100000 - 32
7 - 000001000000 - 64
8 - 000010000000 - 128
9 - 000100000000 - 256
10 - 001000000000 - 512
11 - 010000000000 - 1024
12 - 100000000000 - 2048

Add the Base 10 Outputs together to make a specific combination of buttons to be pressed for your case structure

Lets say you want an action to run when you press the buttons 5, 7, 11 and 12, you would add the base 10 values from each button (16+64+1024+2048) together to make the value: 3152

Please leave any questions or comments on this