Do something for random time using millis

This would probably rather be for a number of cycles, same difference.

This is one place to start

See if that catches any brain cells ready to absorb new knowledge.

You can also google

 arduino finite state machine

and

arduino traffic lights

to get links to very many places describing the use and programming of "finite state machines" or FSMs.

It's a bit of a different way of looking at things but also the key to getting things going. No one gets very far at all with microprocessors without at least knowing these techniques if not embracing them wholsale.

I see the code you posted comes out of the "blink without delay" area, this is in fact a corner of the general idea of FSMs.

BTW - very good idea to play with proxies for the real hardware! A full up system will be easier to get working if you are confidat about the software.

For the same reason, it is advised that when you do start using the real stuff you test it in small steps, small sketches that test and exercise each thing you are attaching. Keep those handy so you can run them when you are in the thick of things to be able to confidently eliminate sources of confusion and error.

a7