Thanks for the help. I wish I could say this is fun but I have a permanent red spot on my forehead from banging it on the table in frustration. I'm close to giving up but knowing that this is something for christmas is keeping me going a little longer.
lol, now I'm even more confused. So I made the changes and I added the code that you gave me but now it blinks twice and pauses right after start up and doesn't change at all based on the door opening. I may have to start from scratch. I seriously that this was an easy thing and that I was just an idiot lol.
int indicate = 3;
int inputPin = 2;
int x = 0;
// Variables will change :
int ledState = LOW; // ledState used to set the LED
int longDelay =0; // long delay state
// Generally, you should use "unsigned long" for variables that hold time
// The value will quickly become too large for an int to store
unsigned long previousMillis = 0; // will store last time LED was updated
unsigned long previousMillis2 = 0; // will store last time long delay was updated
// constants won't change :
const long interval = 300; // interval at which to blink (milliseconds)
const long interval2 = 4000; // interval at which to long delay (milliseconds)
void setup() {
pinMode(indicate, OUTPUT);
pinMode(inputPin, INPUT_PULLUP);
}
boolean lastButton = LOW;
boolean currentButton = LOW;
boolean debounce(boolean last)
{
boolean current = digitalRead(inputPin);
if (last != current)
{
delay(5);
current = digitalRead(inputPin);
}
return current;
}
int i=0;
unsigned long currentMillis2;
void loop() {
currentButton = debounce(lastButton);
if (lastButton == HIGH && currentButton == LOW)
{
x = x+1;
}
lastButton = currentButton;
unsigned long currentMillis = millis();
if (x > 0 && !longDelay) {
if (currentMillis - previousMillis >= interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
if (ledState == LOW) {
ledState = HIGH;
}
else {
ledState = LOW;
i++;
}
// set the LED with the ledState of the variable:
digitalWrite(indicate, ledState);
if (ledState == LOW && i >= x) {
i = 0 ;
longDelay = 1; // done flash
previousMillis2 = millis(); // long delay time start now
}
}
}
currentMillis2 = millis();
if (currentMillis2 - previousMillis2 >= interval2) {
// save the last time your long delay
previousMillis2 = currentMillis2;
longDelay = 0;
}
}
OMG, Bill, you did it!!! That works!! thank you so much and thanks to everyone for the help. I'm going to do my best to learn as much as possible so that I can try being an active member on this site.