LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Switch event by using the same value change of a boolean?

Greetings everyone,

I've got a program with two situations. The situations have to be switched by clicking a button.

So it starts in situation 1, when you click the button it has to go to situation 2, and if you click the button again it should return to 1 and so on.

I can't manage to implement this button in the right way. 

Could anyone help out?

 

0 Kudos
Message 1 of 10
(3,333 Views)

You can change the mechanical action of the 'OK' button to 'Switch when released' and wire the output to a case structure.

0 Kudos
Message 2 of 10
(3,306 Views)

You could store the mode in a shift register.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 10
(3,300 Views)

Could you show me a small example?

0 Kudos
Message 4 of 10
(3,293 Views)

Boolean Case Structure.PNG

0 Kudos
Message 5 of 10
(3,289 Views)

It doesn't work?

it's stuck in the false case

0 Kudos
Message 6 of 10
(3,279 Views)

Why did you add another case structure? Just have one that has a true case that does the code inside the true case, and a false case that does the stuff in the false case.

 

Sorry but the picture I attached is meant to show the different code inside the (singular) case structure. 

 

 

0 Kudos
Message 7 of 10
(3,254 Views)

Even that didnt work. I think because its a pushbutton? When you push it, it turns on and off again. How can i fix that?

0 Kudos
Message 8 of 10
(3,251 Views)

Honestly, looking at your code, I have to say I don't think that the first issue is the case structures.

1) Is there a reason that you are using the DLL to perform serial communications? VISA seems like it would be a much easier option.

2) Is this code designed for a single run or to keep running? If the latter then you need a loop somewhere to ensure that the program keeps running. "Run Continuously" should very rarely be used to operate a program.

3) When are you pushing the button? In order for it to toggle it will need to be set before the program is run. That is how it is with the dataflow (see here).

 

0 Kudos
Message 9 of 10
(3,247 Views)

@sadiek wrote:

Even that didnt work. I think because its a pushbutton? When you push it, it turns on and off again. How can i fix that?


Set the mechanical action to Switch When Released Rather than Latch When Released.

0 Kudos
Message 10 of 10
(3,234 Views)