Navigation

    M5Stack Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. bexybot
    3. Topics
    B
    • Continue chat with bexybot
    • Start new chat with bexybot
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups

    Topics created by bexybot

    • B

      Power Input
      Core 2 • • bexybot

      3
      0
      Votes
      3
      Posts
      934
      Views

      B

      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{ M5.begin(); M5.Axp.SetBusPowerMode(1); } 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();} }else{ Time_bat = 0; } } Hope it helps someone!
    • B

      Wrong ADC readings when using Serial Communication at PortA
      Core 2 • • bexybot

      6
      0
      Votes
      6
      Posts
      1504
      Views

      B

      It worked! Fixed problem eheh!