Photocell programming

Hello, I am using a photocell to open my blinds automatically at dusk.
I currently use a < 70 reading to trigger the blind motors (please note....the motors aren't really blind :slight_smile:
I would like to trigger the motors only at dawn and not at dusk.
How would I program that?
I am thinking a statement that says if the readings are increasing (going from dark to light) then trigger.
Here is a small portion of my code (flag is the state of the blinds, 0 = closed, 1 = open

flag = EEPROM.read(100);
if (photocellReading < 70 && flag == 0)

OPEN();

Thanks for anyone's help

You could study the Arduino State Change example to learn how to detect dawn, rather than dusk (rising intensity, rather than falling). Basically, you compare readings taken a few minutes apart.

You may have to find a way to block other rising signals, like passing car headlights, street lights turning on, etc...

Thanks Jremington, hopefully that will get me on the right track.

Or add a real time clock , temperature might another indicator ?

You will definitely need some hysteresis, and perhaps some time averaging to avoid false triggering
from shadows, lights going past, etc.