Jump to content

Detect which is the last element to change?


Ano Ano

Recommended Posts

Posted

Hello,

I have a set of 50 LED and I want to be able to log which one of them was the last LED to turn on. I imagine I have to place them all to an array, but I have no clue as to how to detect the last LED that turns on.

Any ideas?

Thank you in advance

Posted

Maybe you can use the event structure with value change events, the event structure also gives the time when the event occured

Expanding on this, put all of the LEDs' Value Change events in one case. Wire the CtrlRef terminal into a shift register (or FG, if it's merited) and then you'll be able to use that reference to refer to the LED last updated.

Posted

If you can keep a copy of what the prvious state was, you can do something like this (if you are sure there is only one change, you can just do the search and not the loop):

post-18388-0-37478900-1317391448.png

Posted

If putting the LEDs in an array or a cluster an option, instead of having individual LEDs and then adding them to one event case, it would make the whole thing easier. Then you can just use the the single value change event for the array/cluster, which will give you the old and new values and then you can

If you XOR the old and new values, all the changed booleans will be True.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.