View Single Post
  #1   Spotlight this post!  
Unread 19-11-2009, 23:56
MattSr's Avatar
MattSr MattSr is offline
Mentor/Programmer/Animator
AKA: Matt Cyril Senior
FRC #0488 (Team Xbot)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Seattle, Washington
Posts: 21
MattSr is an unknown quantity at this point
Send a message via AIM to MattSr Send a message via MSN to MattSr Send a message via Yahoo to MattSr
[FTC]: A useful VI I created

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
Attached Files
File Type: zip BoolToNumber.zip (21.1 KB, 21 views)
__________________


Much love to my favorite FRC teams:
1983 Skunkworks - 360 The Revolution - 2898 Flying Hegehogs - 2557 Sota Bots - 2942 Tech Robotics
Reply With Quote