A bit of background first - im posting on behalf of my son, who is learning to code. Im an experienced RF engineer, but hopeless at programming (havent done any since the Spectrum in my youth)
We started with what we thought would be a simple task - simulate a UK type set of railway level crossing lights. This is essentially a case of turning on a yellow LED for a few seconds, then switching to alternating Reds.
We can make the yellow turn on, and off, and can alternate the reds, all well and good. What we cant figure out though, is how to have the yellow come on for a few seconds, then switch to the alternating reds (ie how to do the yellow once then into the loop for the reds). What we get is yellow, red1, red2, then back to yellow as we hit the end of the main loop!
Weve tried playing with do while to try and use a variable to 'count' the steps and jump us out, but that didnt work. Im sure there must be a simple technique!
Can anyone suggest something?
As I say, my programming knowledge is all but non existent!