I have a Photon that sleeps most of time and checks in twice a day to let me know it’s all right. To accomplish this I use System.sleep(SLEEP_MODE_DEEP,SleepTime); SleepTime is set to 18000 so it wakes up every 5 hrs and checks in over Wifi. SleepTime can be set as high as a week (604800) between check ins.
I also have a motion sensor connected to the WKP pin which wakes the Photon up when motion happens. I would like to just count the number of times the motion sensor detects motion and report that number only during check-in. Right now I don’t know if the Photon woke up from the sensor or the timer. I am assuming the long duration sleep makes use of the RTC.
The question I have is when the WKP is triggered, is there a way I can tell the difference between the Photon waking from the SLEEP_MODE_DEEP timer and the Photon waking from the WKP pin being triggered? Is there a flag that gets set that I can read to tell the difference?
The project is a monitor for an animal feeding station which only needs to report the number of times the station has been visited between check in intervals. This project will eventually be ported to the Electron.
Thanks in advance for your help