using LDR as interrupt with sleep


I am currently working on a small simple project: the LED will keep on blinking when the room is bright and go to sleep mode when the room is dark to save power, by using interrupt with sleep mode.

At first it run through setup function - works fine
then go through the loop function - works fine - LED keeps on blinking
When room surrounding is dark - it can print the “OOOOOHH its dark”
but after that the LED just lights up and arduino does not goes into sleep mode!
I dont understand why is it so and I search on the internet , and I still cant find the solution and I am still new into Arduino as my dad tell me to learn it :o :o

Thanks in advance if anyone can give me any insight as to what is wrong with my code.

sketch_1.ino (994 Bytes)

sensorValue = digitalRead(wakePin);//to read current state of LDR
Serial.println(sensorValue);//to print out the current state of LDR

An LDR has different resistance based on the amount of light. Used as part of a voltage divider, you can use analogRead() to determine roughly how much light the sensor sees.

It does not make sense to connect an LDR to a digital pin.

Why shouldn't it? Or rather: not directly, but ...Combined with a Schmidt-Trigger and a capacitor, it could send a pulse to wake up an Arduino.