10-26-2019 05:11 PM - edited 10-26-2019 05:14 PM
Good night guys,
I have in my code a physical button:
https://i.ytimg.com/vi/TIBa_RQB3Ek/maxresdefault.jpg
This button changes the state as soon as you release it. But I need it to be active during the first 2 states as soon as I click it and reset state on third case.
Can you help me?
Is very important.
10-26-2019 07:41 PM - edited 10-26-2019 07:42 PM
"Second" not "Secound".
I don't completely understand what you are doing. It seems like a skeleton of a state machine, that is being driven by a button.
If you need the button to remain "true" so it goes from second to third, why do you even have the button control a select statement in "second" state. Just have it send through the True valie of 0.5 x numeric!
PS: Just attach pictures to your message. Don't stick them out on a 3rd party website.
10-27-2019 06:04 AM
Basically, when I press the button, I want it to stay high for the first 2 states even if I release it.
And I can't do that, because as soon as I release the button it goes down,
10-27-2019 10:32 AM
So you let the value be true for the two states. Eliminate the False choice on those two states and just use the values you have wired up to the True in the select function.
10-27-2019 10:58 AM
Spend a little more time with the LabVIEW Tutorials (or take a class and pay attention). I think the problem is that you do not know that Boolean Controls have something called a "Mechanical Action" that, among other things, handles the question of "When does the button change state" (= "when pressed", "when released", "when read", or combinations of these). The only button I see in your code is a "Stop" button, which (by default) has the Mechanical Action "Latch When Released" (where "Latch" means "stay until read, at which point return to the Default State"). If you want it to "stay pressed", change its mechanical action. But then you'll need to do something to "unpress" it when you want it to be reset ...
Bob Schor
10-27-2019 11:29 AM
With a "physical button", it cannot be done because LabVIEW has no control over the mechanical action. The best you can do is keep the value that goes to the rest of the code TRUE for a given number of iterations. You also need to decide what should happen if the button is held down for more than two states.
Of course you could make a fancy physical button that also has a solenoid actuator so you can control the button state programmatically and keep it down for a given time.