🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Android sketch works with AXP192, but not 2101

    Core 2
    2
    4
    239
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      Krmiller
      last edited by

      I use this code below with AXP192 to determine if the USB power is on/off. I want to power off the core2 when USB pwr is removed. This works with AXP192 but not 2101. What code and libraries would be needed to work with the AXP2101? Also, would be nice if I could determine which AXP this is and use the proper commands. TIA,
      Kris ```
      code_text

      //-----------------------------    power off CTB when USB is powered off -----------------------------------
      
      void checkPWR() {
           battpwr = (M5.Axp.GetBatPower());
          if (battpwr > 100) {                              // Check to see if USB power was removed.
            M5.Axp.PowerOff();                              // Power M5 off
          }
      }
      felmueF 1 Reply Last reply Reply Quote 0
      • felmueF
        felmue @Krmiller
        last edited by

        Hello @Krmiller

        have you tried getType() to determine the correct AXP? See here.

        For AXP2101 you could try getVBUSVoltage. See here.

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        K 1 Reply Last reply Reply Quote 0
        • K
          Krmiller @felmue
          last edited by

          HI @felmue

          Thanks for you reply. After trying to replace the M5core2 library with M5Unified, I see that I'll need to change and retest of number of things. RTC, Buttons, Lcd commands, etc. Is there no other way to address the AXP2101 other than using M5Unified?

          Thanks,
          Kris

          felmueF 1 Reply Last reply Reply Quote 0
          • felmueF
            felmue @Krmiller
            last edited by

            Hello @Krmiller

            GetVBusVoltage() exists in M5Core2 library as well. See here.

            Thanks
            Felix

            GPIO translation table M5Stack / M5Core2
            Information about various M5Stack products.
            Code examples

            1 Reply Last reply Reply Quote 0
            • First post
              Last post