Power Input

  • Hello everyone,

    I have some questions about powering the Core2 module:

    1. Currently, if the device is turned off and is connected by USB-C, it turns on. I would like to know if I put the 5V bus in input mode and feed it 5V the same thing happens.
    2. I was wondering what is the best way to detect the 5V input turning off to turn off the Core2 since there is a battery and it could stay on. Any ideas?

    Thanks very much for your help!
    Fábio Dias

  • So with a bit of research, I develop this simple code that makes exactly what I was asking here:

    #include <M5Core2.h>
    #define DEVICE_TIMEOUT 120000
    float Time_bat = 0;
    void setup{
    void loop{
      M5.Lcd.drawString(("Battery: " + String(M5.Axp.GetBatteryLevel())), 0, 120, 2);
      if(!M5.Axp.isVBUS() && !M5.Axp.isCharging()){
        M5.Lcd.drawString(String((millis() - Time_bat)/1000,0) + "         ", 1, 154, 1);
      }else{M5.Lcd.drawString("Feeded             ", 1, 154, 1);}
      if(!M5.Axp.isVBUS() && !M5.Axp.isCharging()){
          if(Time_bat == 0){Time_bat = millis();}
          if((millis() - Time_bat) > DEVICE_TIMEOUT){M5.shutdown();}
        Time_bat = 0;

    Hope it helps someone!

  • This post is deleted!