Hello,
I am sorry for the delay in this. I have two very active kids and one of them had me at a football tournament all weekend over two hours from home. It was a great weekend for an outdoor tournament, though. I did what you all said. I added notes to the code and I drew out the schematics.
Thank you all so much,
Mike
// Pin 2 is input of start button(s)
const int BUTTON=2;
//Pin 3 is output to LED. It is the only output.
const int LED=3;
// This indicates that the state of the button is an interger but all I really need is HIGH and LOW
int BUTTONstate=0;
// This states that the LED should not light until the safetystart delay takes place.
int safetystart=2500;
//After the LED lights, the duration of it's ON time will be determined by input pin #4.
int timerswitch=4;
//This is the short LED on run time.
int stdrun=5000;
//This is the extension of time the LED should run in excess to the short run time.
int longrun=5000;
//This reads if the LED is on. This will be used to determin if the longrun should be active or not.
int buttonread=11;
//This will read to see if the long run should take place. It reads the position of the switch at pin 4 (timerswitch).
int timerstate=0;
void setup() {
pinMode(BUTTON,INPUT);
pinMode (LED, OUTPUT);
pinMode(timerswitch,INPUT);
pinMode(buttonread, INPUT);
}
void loop()
{
int BUTTONstate=digitalRead(BUTTON);
int timerstate=digitalRead(timerswitch);
int BUTTONagain=digitalRead(BUTTON);
//If the button(s) sending a High signal to input Pin 2 are pressed, wait 2.5 seconds to ensure LED does not turn on if button(s) are only momentarily pressed.
//This ensures the operator truly wants to turn on the LED.
//I say button(s) because I have wired two buttons in series. They are not on separate circuits, so they effectively work as one button, if they are both pressed simultaneously.
if (BUTTONstate==HIGH){
delay(safetystart);
}
//If, after 2.5 seconds, the button(s) are still indicating High, then turn on the LED for the stdrun (standard run time of 5 seconds).
//I understand that the button(s) may become unpressed and pressed again and it will still indicate a High reading. Ideally, I would rather the button(s) need to be held for the duration.
if (BUTTONstate==HIGH){
digitalWrite(LED,HIGH);
delay(stdrun);
}
//At the end of the stdrun of 5 seconds, the Arduino should check to see if the timerstate switch is set to HIGH. If it is set to HIGH, then it should run the longrun (long run time).
//For now, the longrun is also set to 5 seconds, effectively bringing the total LED on time to 10 seconds.
//If the timerstate button is not HIGH, then turn off the LED
if (timerstate==HIGH && BUTTONstate==HIGH){
delay(longrun);
}
//After all timers have completed, turn the LED off.
digitalWrite(LED,LOW);
}