Initiate Sleep for Tracker SoM

Hi Guys,

I’m almost finished with a projector using the Tracker SoM board, except after my program is finished performing I want my Tracker SoM to sleep until a certain pin goes high.

Here is my current if statement that determines when the device sleeps:

            if (sleepTime + (sleepDelay * 60 * 60 * 1000) <= millis()) 
                 {
                 TrackerSleep::instance().wakeFor(D8,RISING); 
                 }

Not sure what I’m missing, but It does not seem to be entering sleep mode…(I have the sleep function from the particle console enabled)

Any advice or recommendations will be tremendously appreciated!

Thank you,
Kevin

The wakeFor() only configures how you will wake after the next time you go to sleep. It doesn’t actually initiate sleep.

What you’d normally do is enable sleep mode from the console. This will configure the basic information about how often you want to wake, including if you also want to wake for motion.

Then, if you want to fine-tune the sleep parameters from code, use the TrackerSleep API. If you need to stay awake, use pauseSleep(). If you want to move the sleep time to a specific time, use wakeAt(). And you already found wakeFor() to add pin wake.