Stormshadow Posted July 27, 2015 Report Share Posted July 27, 2015 Is there a Property Node that detects change of a button, similar to an Event? Context: I inherited a 5x7 square monitors code without any Sub-VIs and the detection of buttons is the following: Note that the Loop is often Late. I need to do an operation when the buttons change state (from ON to OFF) and adding an event case or a Producer-Consumer would be too big of a change (wouldn't be accepted). Is there a better way other than plugging the array into a shift-register and detecting a change in the array, such as an event equivalent property node? Thanks Quote Link to comment
hooovahh Posted July 27, 2015 Report Share Posted July 27, 2015 Is there a better way other than plugging the array into a shift-register and detecting a change in the array, such as an event equivalent property node? You do know this is the exact reason why the event structure was invented right? It meets all of your needs other than the one that states you can't use it. This also would fix your loop being late issue since each event is handled in the order it was received and works like a queue. But if you must insist there is a slightly easier method. You can use the Data Changed subVI from OpenG. Wire anything to it and it tells you if the data has changed since the last time it was called. Still crappy, and you can still click the button twice quickly and not detect a change. I don't know your situation, but when I was in similar circumstances I forced myself to do the right thing, and use the right tools, despite the pain involved. Quote Link to comment
Yair Posted August 2, 2015 Report Share Posted August 2, 2015 (edited) If you really don't want to start modifying the code too much (and based on your description I'm guessing the loop is probably large), another option which is more compact is a feedback node: Edited August 2, 2015 by Yair Quote Link to comment
EricLarsen Posted August 3, 2015 Report Share Posted August 3, 2015 But if you must insist there is a slightly easier method. You can use the Data Changed subVI from OpenG. Wire anything to it and it tells you if the data has changed since the last time it was called. Still crappy, and you can still click the button twice quickly and not detect a change. Just an FYI, there is a better version of this vi from MGI called Change Detector.vi. It operates the same way, but has a drop down polymorphic selector that specifies whether the first call should return a TRUE for FALSE. Brilliant solution to the indeterminate first call issue of the OpenG vi. 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.