How would you code this in logic controller?
My job includes studying and designing programming methods that can express sequence and context.
So here is my question: How would you code the following in the language(s) you use ...
A controller has one push button switch wired to an input, and one lamp wired to an output. The first time the button is pressed the lamp must come on. The next time the button is pressed, the lamp must turn off. On the next press the lamp comes on, etc. etc. Don't forget to allow for the button to be released before it is pressed again.
This is not a trick question or "test". I am simply interested in how a simple example involving sequence and context is handled by different professionals in various languages. I would also be interested in opinions as to how easily a given solution would be to explain to a colleague who is not familiar with the specific language (or operating system)