Ano Ano Posted September 30, 2011 Report Share Posted September 30, 2011 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 Quote Link to comment
BramJ Posted September 30, 2011 Report Share Posted September 30, 2011 Maybe you can use the event structure with value change events, the event structure also gives the time when the event occured Quote Link to comment
asbo Posted September 30, 2011 Report Share Posted September 30, 2011 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. Quote Link to comment
pylb Posted September 30, 2011 Report Share Posted September 30, 2011 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): Quote Link to comment
Ton Plomp Posted September 30, 2011 Report Share Posted September 30, 2011 If you XOR the old and new values, all the changed booleans will be True. Ton 1 Quote Link to comment
Ravi Beniwal Posted September 30, 2011 Report Share Posted September 30, 2011 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. 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.