Hi mackrackit
Mm, how about sending the PIC back to SLEEP awaiting another Interrupt_On_Change (the birds have started visiting again it was only a cloud) so carry on counting. If after say SLEEP 1800(about half an hour) the LDR is still high then Send_Data it really is dark!It is easy to have false triggers when sensing light, sensing "dark" at dusk could give trouble. You may want to incorporate a timer of some kind not to send the data until you are "sure" it is dark. The dark trigger has to be active for 30 minutes???
Oh dear, Badgers I don't mind (even Bears seem kind of cuddly) but bugs!!!What if there is a bug on the sensor?? A real bug...
I think the code would have to be something like:
That's an interesting point though because the Birds don't always fly straight into the nest box they quite often hang by the hole then enter so the timing(or lenght of time) of the INPUT COUNTER will need some thinking about.Code:IF Count_Input_Pin is HIGH for >50ms THEN SEND: SEND: 'Mrs LEDave into the garden and clean the sensor. RETURN.
Dave





Bookmarks