I want to make something that can be battery driven for a long time with M5StickC.
As an operation, M5StickC is in Deep Sleep state → button is pressed → process is performed → Deep Sleep state is entered again.
I tried the following code, but M5StickC runs out of battery in one day. Even if I press the button after one day, it doesn't return.
#include <Arduino.h>
#include <M5StickC.h>
#include "driver/rtc_io.h"
RTC_DATA_ATTR int bootCount = 0;
void setup(){
M5.begin();
++bootCount;
M5.Lcd.println("Boot number: " + String(bootCount));
rtc_gpio_pullup_en(GPIO_NUM_37);
esp_sleep_enable_ext0_wakeup(GPIO_NUM_37,LOW);
M5.Lcd.println("Going to sleep now");
delay(1000);
M5.Axp.ScreenBreath(0);
esp_deep_sleep_start();
}
void loop(){
}
The information I got stated that it was consuming power because it was in a pull-up state. So I set it to pull-down during normal times so that it returns when it goes high. However, if I do so, it will return immediately after entering the DeepSleep state, and it will repeat indefinitely.