This may be a little cheeky but I am trying to program an uno to run a small section of a garden railway, the sort that people sit astride the carriages behind small steam engines. I want to control four sequential signals. Two of which are four aspect, that is they have four lights, red, yellow, double yellow and green. One has three aspect - red yellow and green and one has two aspect, red and green. By using diodes I could use just two yellow lights and have one or both light as required from two outputs.
There are five switches that the trains trigger as they pass.
The lights go to red when first turned on, if relays are used on the outputs the first relay could be de-energised to light the red lights and energised to light the yellow. When the system is reset everything finishes with all on green, this could be done by one pass of a train and not a separate switch.
When a train passes the first switch the first signal (four aspect) goes red. When it passes the second switch the second signal goes to red and the first to yellow. This sequence continues until the train passes the fifth switch, because the third signal is three aspect and the forth two it would mean that the fifth switch turns the second signal and both the third and the four signals to green.
A second train could enter the system when the first train is beyond the second switch and the first signal has gone to yellow.
If anyone is interested in a challenge I would welcome the input. Can you do it in fewer ports from the uno than the eighteen it first looks as if it requires? remember a relay on the output could save at least one output to each signal.
Thanks for at least reading this far, Bob.