LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use Keyboard as a command to start the Case structure

Solved!
Go to solution

@Sina90 wrote:
The last thing that I'm looking for, is that the loop count starts counting from zero and goes to infinity unless you push the 'b' button. How can I modify it so that the first time I push the 'b' button, it prints 1 in an indicator, and second time I push the 'b' button it prints 2 and so on.

To have a counter which conditionally iterates, you can use a shift register and a case structure. It sounds like (replying from phone so can't see, sorry!) Robert's example uses an Event Structure. In that case, one of the events handles the key press. Inside that case, wire the Increment function to your counter coming out of the shift register you create on the left of your while loop. Wire this increased value out of the event structure and onto the right side shift register.

 

In every other case of the event structure, just wire straight through without changing the value. Depending on how many cases you need to handle, you might find "linked tunnels" (or a similar name, again, can't check - sorry...) useful. They're on the right click menu for the tunnel box.


GCentral
0 Kudos
Message 21 of 21
(487 Views)