🤖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?

    Units
    2
    2
    19
    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
      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
        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!

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