LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Forward button increment of PicRing that already has pic rotation implemented.

I have a pic ring that has about 30+ pics. Also these pics rotate every three seconds or so so that every pic is individually shown at the three second interval. That works fine, but I also want to implement a Forward button that can increment thru the rotating pic ring as well. Right now, the pic rotation works fine, but when I press the Forward button, nothing happens. As well, the boolean value for the button stays True when it should turn False and the button should revert back to its original setting. And finally, my code for the Forward increment works fine alone, but when combined with the code for rotation, everything gums up. My vi. is attached here.

0 Kudos
Message 1 of 4
(3,085 Views)

You might want to turn on highlight execution so you can better understand how your VI is working and why it isn't working the way you want to.

 

You hit the button, but what you think is "nothing happens", is that the 3 second wait in the False case is still executing.  Not until that ends, the loop iterates again, does the button get read and then the picture advances again.

 

(By the way, the 1 iteration For Loop and the shift register aren't doing anything in that True case.)

 

What you need to do is have a single loop with an event structure.  Have an event that handles the value change for the button.  Have a timeout event with 3000 (for milliseconds) wired to the timeout node.  Have the advancement of the picture ring occur in either event.  Keep the indicator outside, and use a shift register, and you won't need any of those local variables.

0 Kudos
Message 2 of 4
(3,060 Views)

Okay thanks. I actually forgot about the Event Structure. I'll try that route. And I do think the hold up has to do with that 3 second delay. I've found the boolean of the button does change back to false eventually but...the picture doesn't change. So....it almost almost works. 

0 Kudos
Message 3 of 4
(2,998 Views)

The picture didn't change because whether you finish waiting the 3 seconds or press the button, the ring increments by 1 either way.  The difference is you want the button to increment the picture RIGHT NOW, which is a question of timing and using the event structure allows it to handle that.

0 Kudos
Message 4 of 4
(2,995 Views)