🤖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

    Scheduled Pinned Locked Moved Core 2
    4 Posts 2 Posters 3.2k Views
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            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

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post