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

    M5stack BASIC v2.6 GPIO16 input problem

    Scheduled Pinned Locked Moved Bases
    5 Posts 3 Posters 8.1k 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
      kazyam53
      last edited by

      I want to use GPIO16 on M5stack basic v2.6 as digital input but it doesn't work.
      I have tried on the code below but it always return 1.
      ・It's work well on M5 stack gray (default 0, when input 3.3V it return 1).
      ・In case I use GPIO17,25,26, it can also work well.
      ・I have 2 of basic v2.6 but both of them have same issue.

      This is the code I have tested.

      #include "Wire.h"
      #include <M5Stack.h>
      
      #define DIN 16
      void setup() {
        //start serial connection
        M5.begin();
        M5.Power.begin();
        Wire.begin();
        Serial.begin(9600);
        pinMode(DIN, INPUT_PULLDOWN);
      }
      
      void loop() {
        int sensorVal = digitalRead(DIN);
        Serial.println(sensorVal);
      }
      

      Do you have any solution or find issue on my code?
      Thank you in advance for your help.

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

        Hello @kazyam53

        M5Stack basic v2.6 seems to have some kind of pull-up resistor (about 3.3 k) on GPIO16. Not sure why and not sure why only on GPIO16.

        That said, you'll need to change your code to pinMode(DIN, INPUT_PULLUP); and then either leave GPIO16 open (reads 1) or connected to GND (read 0).

        Thanks
        Felix

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

        1 Reply Last reply Reply Quote 0
        • K Offline
          kazyam53
          last edited by

          @felmue
          Then I need to change design... thank you so much for answer.

          1 Reply Last reply Reply Quote 0
          • M Offline
            macsbug
            last edited by

            Hello @kazyam53

            M5Stack Basic V2.6

            There is a small clearance between the M-BUS and the metal surface on the back of the Speaker, and some are in contact with each other.
            There is a risk of short circuit of M-BUS (GND, 23,19,18,3,16,21).

            0_1655952413452_Unknown.jpeg

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

              Hello @macsbug

              I've noticed that too. However there is insulation (capton tape) on the back of the speaker in my M5Stack base v2.6.

              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