05-02-2021 07:27 PM
Hello everyone!
What I want to program are 3 buttons (let's say A, B, C), and for operator to be able to switch to A (from B or C) a certain conditions must be fulfilled. Same for the other two. So if B is lighten up and he presses button A, button A lights up only if for example, Temperature is under 50 degrees. I want them to be exclusive from each other (only one can be on) but all of them can be off.
Could you help me with this? Would really appreciate if someone could upload a simple example in a .VI
Thank you so much!
Solved! Go to Solution.
05-02-2021 09:06 PM
I would probably go with radio buttons with the option to have none as a valid selection.
05-02-2021 09:25 PM
Hey thank you for replying I really appreciate it!
That's what I've tried (I still need to add the OFF option), but now I'm facing another problem. So the three button options I've set are: warmup, standby and ready.
Given two number controls A and B, to be in Standby A=0 and to be in ready A=0 and B=0 and warmup doesn't have any condition. But I also want to program it so that if the READY button is pressed (A=0 and B=0) but I change manually B=2, I want the button to go back to STANDBY position. Is there any way to do this?
I attach what I've done so far.
I'm very new to LabView so maybe there is some mistake in my .VI
would really appreciate all your feedback, thank you!
05-03-2021 12:01 PM
I will have to look at it from home; my version at work is older than your VI.
05-03-2021 12:51 PM - edited 05-03-2021 12:57 PM
Hi Irene,
@IreneAd wrote:
I'm very new to LabView so maybe there is some mistake in my .VI
would really appreciate all your feedback, thank you!
See this:
You really should learn the basics, like avoiding (unneeded) local variables or setting up the event structure correctly!
There's only one local variable left now…
@IreneAd wrote:
But I also want to program it so that if the READY button is pressed (A=0 and B=0) but I change manually B=2, I want the button to go back to STANDBY position. Is there any way to do this?
Yes, sure! You just need to program it according to your requirement!
When the event structure/case should react on value change events of B then why didn't you setup the event case for that event?
Do you spot the difference?
Btw. why did you choose the DBL datatype for A&B, when you just check for "==0" or "<>0"? Why don't you use a boolean controls instead?
05-04-2021 05:35 AM
Oh, I see... thank you!
So does that mean that if I want the program to update the value of A and B, I have to add them to the event structure value change?
And in case I had more controls, let's say A,B,C,D,E,F,G,H,I. Should I add them just like I did (edit events handled by this event case) or is there an easier way to do it (maybe put all of them in an array?)
If A and B were local variables (because I had to use them somwhere else), would this work the same way?
I used DBL because I was just testing, but you are right a boolean control would be simpler.
Thank you! I'm slowly learning how LabView works so if you have any recomended guides on this feel free to mention them.
05-04-2021 05:43 AM
Hi Irene,
@IreneAd wrote:
So does that mean that if I want the program to update the value of A and B, I have to add them to the event structure value change?
No, the other way around!
When the user changes the values in A or B then then event case is handling those ValueChange events!
@IreneAd wrote:
And in case I had more controls, let's say A,B,C,D,E,F,G,H,I. Should I add them just like I did (edit events handled by this event case) or is there an easier way to do it (maybe put all of them in an array?)
General rule: related items of the same datatype belong into an array…
(Why handle 9 items individually when you can handle them at all within one array?)
@IreneAd wrote:
If A and B were local variables (because I had to use them somwhere else), would this work the same way?
No.
The event structure handles ValueChange events, which come from user input or special "Value(signalling)" property nodes! Writing to local variables will not create a ValueChange event!
05-04-2021 05:47 AM
So in case I had to use A and B as local variables because they come from somewhere else, what would you use to program the same functionality?
Sorry for asking so many questions, I'm a bit confused.
05-04-2021 05:52 AM
Hi Irene,
@IreneAd wrote:
So in case I had to use A and B as local variables because they come from somewhere else, what would you use to program the same functionality?
I would use a different approach than an event structure waiting for user input…
What about a statemachine, checking conditions and changing states as needed?
What about using User events when you want to stick with an event structure?
There are so many options, depending on your (complete list of) requirements…