// CODE TO repeatedly check the switch halt
#include "oled.h" //load the oled with Adafruit_SSD1306.h library
//vars
int LED2 = 2; // LED 2 on PIN 2
int LED3 = 3; //
int LED4 = 24; //
int SWt = A2; //button on A0
void setup() {
setup_oled(); // Start the OLED Display
}
void loop() {
display_counter(HIGH); //NEEDED FOR DISPLAY TO WORK ## ALL LOOP CODE UNDER THIS
zerocounter(20); //restart counter after 20
MY_HALT(); //check halt
if (digitalRead(A0) == LOW) setcounter(-1); //set counter to -1 if button pressed
if (counter() == 0) step1();
if (counter() == 2) step2();
if (counter() == 4) step3();
if (counter() > 6) END();
}
void MY_HALT() { //subroutine to check switches
while (digitalRead(SWt) == LOW) { //pause
OLED_TXT("PAUSED");
//##### code
}
}
void step1() { //subroutine to check switches
OLED_TXT("step1");
//#
}
void step2() { //subroutine to check switches
OLED_TXT("step2");
//##
}
void step3() { //subroutine to check switches
OLED_TXT("step3");
//###
}
void END() { //subroutine to check switches
OLED_TXT("END");
//###
}