Hello there, I'm a complete begginer in programming for the Arduino and need some help...
I'm building a lucid dreaming induction device, that while asleep and dreaming would deliver flashing lights to recognize the dream state.
The Arduino flashes my desktop lamp through a relay (works fine).
The code does the following:
relay off (40 min)
alarm (blinking)
relay off (10 min)
alarm (blinking)
relay off (10 min)
alarm (blinking)
relay off (10 min)
alarm (blinking)
The problem is:
that if the "alarm" wakes me up I can't fall asleep again because the next alarm will go off in ten minutes.
-Possible solutions-
When woken up in the middle of the night, press a debounced pushbutton or switch to:
1. Somehow add a twenty minute delay (my sleep onset time) before resuming the alarm pattern. I've thought of using interrupts but as they cannot contain the delay function, I'm pretty lost...
or
2. When the switch is pressed, skip or silence the next two alarms. Tried control statements but couldn't sort it out.
Hope I made myself clear... :~
Thank you in advance