using 2 diffrent commands controlled by toggle switch

ok noob question but I have these 2 programs that control 15 slave clocks how would I combine them to run program 1 99% of the time but switch to program 2 by pressing a button

Clock-1 main operating program.txt (1.41 KB)

Clock2.txt (1.32 KB)

You'll need to eliminate the delay()s so you can poll the state of an input pin connected to your switch. See the "Blink without delay" example.

I suggest enabling the internal pullup resistor on the input pin and connecting the other side of your switch to ground.

Go ahead and put a delay(10) after you switch states (either direction) to limit switch "bounce".