mtnbkr88 / ESP32CAMRemotePIR

ESP32-CAM Remote PIR Solar Powered Picture/Video Emailer
12 stars 2 forks source link

time for webserver to run #5

Closed Patsjemoe closed 1 year ago

Patsjemoe commented 1 year ago

Hi Ed, I would like the time the server runs to bring back to 1 min (or even zero to save power, and only email pictures when moving). if ( millis() - timeout_10min > (10 60 1000) ) {
do_deep_sleep();

I changed it to : if ( millis() - timeout_10min > (1 60 1000) ) {
-- > so I expected 1 min but it does not go asleep after 1 min... Any suggestions to what I do wrong ? Thanks in advance regards Ludo

Patsjemoe commented 1 year ago

Hi Ed, When I change to if ( millis() - timeout_10min > (1 60 100) ) { ...it goes asleep after 6-7 sec...which is accordingly.. Not sure why , do not understand regards Ludo

Patsjemoe commented 1 year ago

Hi Ed, I used different cams for the 2 tests, with 1 device, it works , with the other one, it is not going to sleep.....if someone understands this ? Regards Ludo

Patsjemoe commented 1 year ago

Hi Ed, You can forget the question, but want to share this issue, as it is simple, but at the same time difficult to find. I adapted from PIR to detection when a switch opens, with a pulldown resistore external, so would be triggerd with 3V on pin 13. When I adapted my program to 1 minute, it did not work, as there was in fact a constant trigger from the switch that was at 1 (in my application, it is pushed down to give a 0, and gives a 1 when the roof of the squirl feeding house opens, but as I was working on it, the roof was constantly open...) It works fine now, testing how long it works on battery....

mtnbkr88 commented 1 year ago

Glad you got it working for a detector for when a squirrel opens his nut house. For your first question change the math to (6 x 1000) and you'll understand. millis() gives a value in milliseconds. 1000 milliseconds is one second. So 6 x 1000 is 6 seconds. Using (60 x 1000) should have worked for a 1 minute timeout.