// student name -- ..swA2 is a reset counter
#include "oled.h" //load the oled with Adafruit_SSD1306.h library
int LED6 = 6; //RED LED on pin 6
int countz = -5; //start counter on -5 for runup
void setup() {
setup_oled(); // Start the OLED Display
}
void loop() {
sdelay(100); //always need a short 0.1s delay
countz++; //ADD 1 to the counter every o'l secs
OLED_SENSOR("time tenths=", countz);
if (countz < 5) { //0.5 secs
OLED_SENSOR("TIME START=", countz);
NEOLED(1, blk); // NEOLED 1 black turn them all off at once
}
if (countz == 20) NEOLED(1, red); //one ata time
if (countz == 40) NEOLED(2, amb);
if (countz == 70) { //do several at once
NEOLED(4, grn);
NEOLED(5, blu);
NEOLED_SENSOR("EGG DONE", countz);
}
sw_A2(); // reset the counter function()
}
void sw_A2() { // this checks A0
while (digitalRead(A2) == LOW) { // stop on slider sw up
OLED_PRINT("HALTED / RESET");
digitalWrite(6, HIGH); // + turn red lED on
sdelay(100); // run the warning repeatedly
countz = -1; //keep restarting the counter
// further code here
}
digitalWrite(6, LOW); // + turn red lED off when sw released
}