|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
HELP!!! BOOLEAN VARIABLES IN LABVIEW
Hey guys, I'm having some trouble getting limit switches working in our robot. We are using 3 Limit Switches for different positions on the Lazy Susan. We have planned out the code in notepad as follows,
Code:
//ls1 = limit switch 1 //ls2 = limit switch 2 //ls3 = limit switch 3 // 1= go left //-1 = go right boolean left = 0 boolean top = 0 boolean right = 0 if (ls1 = 1) then left = 1 end if if (ls2 = 1) then top = 1 end if if (ls3 = 1) then right = 1 end if //button 4 if (left = 1 && top = 1 && right = 0) then speed = 1 if(left = T) then top = 0; speed = 1until ls1 = 1 end if if (left = 1 && top = 0 && right = 0) then speed = 1 speed = 1 until ls1 = 1 end if if (left = 1 && top = 1 && right = 1) then speed = 1 until ls1 = 1 end if if (ls1 = 1 and left = 1) then speed = 0 end if /button 5 if (left = 1 && top = 0 && right = 0) then speed = - 1 until ls3 = 1 end if if (left = 1 && top = 1 && right = 0) then speed = - 1 until ls3 = 1 end if if (left = 1 && top = 1 && right = 1 && ls3 = 1) then speed = 0 end if /button 3 if (left = 1 && top = 0 && right = 0) then speed = 1 until ls2 = 1 end if if (left = 1 && top = 1 && right = 0) then speed = -1 until ls3 = 1 end if if (left = 1 && top = 1 && right = 1) then speed = - 1 until ls3 = 1 end if if(ls2 = 1) then speed = 0 end if Last edited by PRAWG : 07-02-2009 at 13:13. |
|
#2
|
||||
|
||||
|
Re: HELP!!! BOOLEAN VARIABLES IN LABVIEW
You can create a booolean variable by right-clicking on the front panel of the VI and selecting Modern and then navigating to the Boolean palette. There should be options there. An indicator/controller will appear on the backpanel.
To init the boolean, you can wire a constant to it, and then reference the boolean by local variables, (created by right-click on the object > create > local variable). The initial value will only be used when the indicator hasn't been accessed by a local variable and updated. |
|
#3
|
|||||
|
|||||
|
Re: HELP!!! BOOLEAN VARIABLES IN LABVIEW
For the most part, in LabVIEW, what would be variables in C are just wires between things. I don't think you need to do anything special. Just read the state of your limit switch. Its output will be a boolean value that you can wire up to the rest of your functions.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Making global variables in LabVIEW. | Joshamuffin | National Instruments LabVIEW and Data Acquisition | 1 | 19-01-2009 13:35 |
| [FTC]: Variables in labview | wilsonmw04 | FIRST Tech Challenge | 2 | 23-11-2008 08:57 |
| Labview dashboard and multiple variables | Joe Ross | LabView and Data Acquisition | 2 | 15-03-2006 21:55 |
| Help figuring out controller variables | fwxer | Programming | 1 | 31-01-2005 02:28 |
| Need help with Variables ? | David Bryan | Programming | 5 | 23-02-2004 07:42 |