pimoroni / badger2040

Examples and firmware for Badger 2040 and Badger 2040 W
MIT License
165 stars 52 forks source link

Waking from Sleep at a specific time of the day #56

Open tibaultbordeaux opened 1 year ago

tibaultbordeaux commented 1 year ago

Hello all,

I'm able to wake up my badger after a certain amount of time:

badger2040.sleep_for(minutes)

But how would I wake up at a certain time, i.e. 8:00 a.m. every day?

Thanks for help!

exussum12 commented 1 year ago

https://github.com/pimoroni/badger2040/blob/a8552a55ad090783f9bf06aa2a07821051accf87/firmware/PIMORONI_BADGER2040W/lib/badger2040.py#L158

That is how the RTC works internally but its not exposed here.

You can work out the minutes in a similar way to that method or set up the RTC directly in your code (this will be harder but follow what the code above does)