Ten Minute Code
const int switch_on = 5, output = 9;
int offtime = 1, off_timer_start = 0;
void setup() {
pinMode(switch_on, INPUT);
pinMode(output, OUTPUT);
}
void loop() {
int x = ((millis() / 10000) - off_timer_start) / 60;
if (digitalRead(switch_on) == HIGH) {
off_timer_start = (millis() / 10000);
digitalWrite(output, HIGH);
} else if (x >= offtime && digitalRead(output == HIGH)) {
digitalWrite(output, LOW);
}
delay(1000);
}
................................................................................................................
1 Minute Timer Code
const int switch_on = 2, output = 9;
int offtime = 1, off_timer_start = 0;
void setup() {
pinMode(switch_on, INPUT);
pinMode(output, OUTPUT);
}
void loop() {
int x = ((millis() / 1000) - off_timer_start) / 60;
if (digitalRead(switch_on) == HIGH) {
off_timer_start = (millis() / 1000);
digitalWrite(output, HIGH);
} else if (x >= offtime && digitalRead(output == HIGH)) {
digitalWrite(output, LOW);
}
delay(1000);
}
Comments