// 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 == 50) NEOLED(3, yel);
if (countz == 60) NEOLED(4, grn);
if (countz == 70) NEOLED(5, blu);
if (countz == 80) NEOLED(6, red);
if (countz == 90) NEOLED(7, amb);
if (countz == 100) NEOLED(8, yel);
if (countz == 110) NEOLED(9, grn);
if (countz == 120) NEOLED(10, blu);
if (countz == 130) NEOLED(11, red);
if (countz == 140) NEOLED(12, amb);
if (countz == 150) NEOLED(13, yel);
if (countz == 160) NEOLED(14, grn);
if (countz == 170) NEOLED(15, blu);
if (countz == 170) { //do several at once
NEOLED(4, grn);
NEOLED(5, blu);
}
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
NEOLED(1, blk); // NEOLED 1 black turn them all off at once
NEOLED(2, blk); // NEOLED 1 black turn them all off at once
NEOLED(3, blk); // NEOLED 1 black turn them all off at once
NEOLED(4, blk); // NEOLED 1 black turn them all off at once
}
digitalWrite(6, LOW); // + turn red lED off when sw released
}