Make pause push button


I have a program that has many delays in different parts of it. i want to have a pause push button (first press pause, second press continue the program) write now with delays in the program I cant monitor the push button status all the time. what can i do to monitor the status even during the delays?

Part of the code is as follow: for (i=0; i=24; ++i){

digitalWrite(SSRPin, HIGH); delay(500); digitalWrite(SSRPin, LOW); delay(500); }

Get rid of the delays. Don't use delay for timing. Learn and embrace the method illustrated in the "Blink Without Delay" example. Instead of freezing the code execution in a delay, simple note the time and let the loop continue to run and in that loop check to see if it is time to do the next thing.