cancel
Showing results for 
Search instead for 
Did you mean: 

Switching State with Boolean Button Press/Counter/Timing

SOLVED
StevenD
Active Participant
Solution

Re: Switching State with Boolean Button Press/Counter/Timing

Message contains an image

This seemed to work pretty well and is easy to modify for different timing/boolean states.

 

Use a producer/consumer-ish design but with a DVR instead of a Q. Consumer loop reads the DVR every 5 ms and updates the booleans as needed. Producer mostly just waits for the user to trigger, then we set lines 3 and 4 high, use the structure of the in place element to pass a wire through to a wait, then not lines 1 and 2.Capture.PNG

tuyenhoang7
Member

Re: Switching State with Boolean Button Press/Counter/Timing

Wow, this looks great, though a little more involved than I had thought. Would you mind sharing this .vi with me, so I can play around with it?

 

Thank you

StevenD
Active Participant

Re: Switching State with Boolean Button Press/Counter/Timing

Message contains an attachment

Sorry I was busy at work all day. Here is the code LV2014

 

tuyenhoang7
Member

Re: Switching State with Boolean Button Press/Counter/Timing

Message contains an attachment

Thank you so much for this, your code is great, and does what I described. I need to have state 3 and 4 ON a little later however, after state 1 (or state 2) is ON, instead of before. I attached a picture showing the change. On the left is what your code is doing. On the right, is what I need to change it to. I tried figuring it out myself, but I have a feeling that I have to change the order in which the inputs are going to, and I was not sure how to proceed.

 

Thank you, you have been very helpful.

StevenD
Active Participant

Re: Switching State with Boolean Button Press/Counter/Timing

That's an easy fix, expand the index array terminal on the first in place element structure and NOT lines 0 and 1, then remove the NOTs from the second in place element structure.

tuyenhoang7
Member

Re: Switching State with Boolean Button Press/Counter/Timing

Awesome man, that fixed it for me. Elegant solution, and easy to modify. I learned a lot from it also.

Thank you again! I marked it as a solution, plus kudos to you!