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

    UNIT-EARTH with a M5Stack Core - Proper Pin?

    Scheduled Pinned Locked Moved Units
    4 Posts 2 Posters 2.9k Views 1 Watching
    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.
    • W Offline
      wwhite
      last edited by

      Is the the correct code when using a M5Stack core. I don't get any changes when reading the values? Thanks in advance.

      #include <M5Stack.h>

      void setup()
      {
      M5.begin(); // Init M5Stack. 初始化M5Stack
      M5.Power.begin(); // Init power 初始化电源模块
      M5.lcd.setTextSize(2); // Set the text size to 2. 设置文字大小为2
      M5.Lcd.printf("UNIT_EARTH EXAMPLE\n");
      pinMode(26, INPUT); // Set pin 26 to input mode. 将引脚26设置为输入模式
      dacWrite(25, 0); // disable the speak noise. 禁用喇叭
      }

      void loop()
      {
      M5.Lcd.setCursor(0, 80); // Set the cursor at (0,80). 将光标设置在(0,80)
      M5.Lcd.printf("AnalogRead:%d\n", analogRead(36));
      M5.Lcd.printf("DigitalRead:%d\n", digitalRead(26));
      delay(1000);
      }

      teastainT 1 Reply Last reply Reply Quote 0
      • teastainT Offline
        teastain @wwhite
        last edited by

        @wwhite Did you plug the UNIT into the red socket on the left side?
        These inputs are: 21 and 22.
        You could plug it into the discrete I/Os around the base on the right side where you will find 26 and 36.

        Cheers, Terry!

        100% M5Stack addict with several drawers full of product!

        W 1 Reply Last reply Reply Quote 0
        • W Offline
          wwhite @teastain
          last edited by

          @teastain Thank you. It's got a grove connector and I didn't want to cut it.

          1 Reply Last reply Reply Quote 0
          • W Offline
            wwhite
            last edited by

            I don't recommend this product. This is what it looks like after being in a barely damp plant overnight! No wonder I couldn't get any readings! IMG_9390.jpg

            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