Commit c1b8136d authored by jack.templeman's avatar jack.templeman

Add new file

parents
const int switchP = 8;
int led = 2;
int switchS = 0;
int prevSwitchS = 0;
unsigned long pTime = 0;
long duration = 600000; //this is the interval for each LED (600000 being 10 minutes)
void setup() {
for(int x = 2; x<8;x++) {
pinMode(x, OUTPUT);
}
pinMode(switchP, INPUT);
}
void loop() {
unsigned long cTime = millis(); //this is the timer
if(cTime - pTime > duration){
digitalWrite(led, HIGH); //turns the LED on if the duration has been completed
pTime = cTime; //resets duration to 0
led++;
if(led ==7){ //stops at the last LED
}
}
switchS = digitalRead(switchP); //handles the switch reset
if(switchS != prevSwitchS){
for(int y = 2; y<8;y++){
digitalWrite(y, LOW);}
led = 2;
pTime = cTime;
}
prevSwitchS = switchS;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment