- Your setup loops are nested. They should not be. Each setup for statement should probably be like:
int i;
for (i = 9; i < 12; i++) { do stuff - the stuff inside the brackets for this for loop is what gets executed }
-
Look at the blink without delay example. This shows how to achieve a concurrency effect without using delay.
The delay statement pauses all execution - the whole processor waits.
Write down, on paper, the steps needed to if you have a watch.
e.g. Light 1 is to flash in 60 secs - write down time1 now.
Light 2 is to flash in 120 seconds - write down time2 now.
Start loop
Look at watch. Is the current time - written time1 > 60? If so, switch the light, depending on main switch. Record the time again.
Look at watch. Is the current time - written time2 > 120? If so, switch the light, depending on main switch. Record the time again. -
The fact you have an emergency something I cannot help you with.
-
We could perhaps help you if you gave a clear indication of what you are trying to do, and what currently happens. What is the main switch?