Nightlight with a twist

My goal is essentially a nightlight that turns on immediately when the light in the room dims, stays on for a few minutes and then turns off. That I have no problem with. However I also want the light to stay off until the next time the room darkens again which could be anytime (hours or days later).

As the code is now the light is always on as long as the room is dark (or the PR is covered).

Playing with basic code I’m able to make the light turn on. That’s easy. I can also time the light so it turns on for a few seconds after I take my finger from the photoresistor. I just can’t figure out how to make the cycle stop and the light turn off and stay off when the room is dark.

I’ve played with delays after the LOW condition and the light may not go on again without resetting the UNO.

The end goal is a device that goes into a commercial darkroom and turns on a dim light for about 10 minutes immediately after the main light in the room goes out. This gives the operators’ eyes time to adjust to full darkness (a problem we’ve been dealing with for a while). For obvious reasons the light can’t stay on (or turn back on) when we’re working.

Your help is appreciated.

sketch_apr21a.ino (464 Bytes)

If you had read the locked posts at the top of this forum, you would have posted properly by using code tags. Many people such as me want to provide free help to you but use mobile devices that are not able to display an ino file. Perhaps I could have helped you if I could have seen your code, but I cannot help you if you do not post correctly.

It would be nice if mobile devices were better behaved in this respect but unfortunately they are not.

Help us to help you.

remoquin:
As the code is now the light is always on as long as the room is dark (or the PR is covered).

This is a shot in the dark (pun intended) but set things up so the ten minute timer starts when the room *goes *dark - see IDE->file/examples/digital/state change detection. As long as these conditions pertain; the timer is enabled and not done, keep the dim light on.