 // Soldered on a perfboard with a Kingbright 3 digit 7 segment common cathode LED module.
 
 // Version history:
+// 0.95: Added check to ignore the button press that wakes the Atmega.
 // 0.94: Added basic avr Sleep untill interrupt. Removed Narcoleptic_m8, didn't work.
 // 0.93: Added Narcoleptic_m8 library and sleep function.
 // 0.92: Beta for 5th version (button pin changed to hardware interrupt pin).

  pinMode(digit2pin, OUTPUT);
  pinMode(digit3pin, OUTPUT);

  // Setup specific for prototype 2.
  // Pullup resistor on button pin
  pinMode(buttonpin, INPUT);
  digitalWrite(buttonpin, HIGH);       // turn on pullup resistor

      }
      // There was an interaction, reset the sleep timer.
      timer = 0;
      // Reset the dim value.
      reset = 6;
    }
  }
  // save the current state as the last state, 
  // for next time through the loop
  lastButtonState = buttonState;

  // The timer that sleeps the device.
  // 30000 ticks is about 26 seconds.
  // 2076921 is about 30 minutes.
  if (timer > 2076921)
  //if (timer > 10000)
  {
    reset = 20;
  }

  // 8307692 is about 2 hours.
  if (timer > 8307692)
  //if (timer > 30000)
  {
    digitalWrite(digit1pin,0);
    digitalWrite(digit3pin,0);
    digitalWrite(digit2pin,0);  
    sleepNow();     // sleep function called here
    ignorePress = 1;
    timer = 0;
  }
  
  ////////////// 
