micropython-Chinese-Community / mpy-lib

HTS221, LPS22, LIS2DW12, LIS2MDL, LSM6DSO, STTS751, si7051, bme280, bmp280, APDS9930, TM1650, TM1637, LCD1602, GNSS, all kinds of micropython drives, examples, libs
MIT License
173 stars 73 forks source link

Wake up esp32 each 2 or 3 hours #13

Open GeralDennis opened 2 years ago

GeralDennis commented 2 years ago

Hi, the alarm allows esp32 wake up each 2 or 3 hours? I was trying to wake up esp32 every two hours using this line "_ds.ALARM(ds.Day(), (ds.Hour() + 2)%24, 46, DS3231.PERHOUR)" but the esp32 keeps waking up every hour. Can you help how to do it? Thank you in advance.

shaoziyang commented 2 years ago

In fact, ds3231 has hourly alarm mode, but it does not support alarm every few hours. So you may set it alarm next two hour before esp32 sleep, just like ds.ALARM(ds.Day(), (ds.Hour() + 2)%24, 46, DS3231.PER_DAY).

图片