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

    Env III Hat defectuous ?

    Modules
    3
    8
    4.9k
    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.
    • J
      jhashe
      last edited by

      Hello,
      I just bougth a M5StickCPlus and a ENV III hat. It's my first contact with M5Stack.
      I downloaded the code sample here
      https://github.com/m5stack/M5Unit-ENV/blob/master/examples/Unit_ENVIII_M5StickCPlus/Unit_ENVIII_M5StickCPlus.ino
      No problem to compile neither to run, but it always returns 0.
      So I tried to change some parameters, especially in this line:
      Wire.begin(32, 33);
      I tried with Wire.begin(0,26); and Wire.begin();
      But always the same problem.
      Could the module be defectuous ?
      Thank's for your help

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

        Hello @jhashe

        Wire.begin(0, 26) in setup() should be correct.

        However there is an additional Wire.begin() inside M5Unit-ENV/src/SHT3X.cpp which gets called first and most likely is the issue. I suggest you try to comment that one out.

        BTW: In the past that would not have been an issue as the last call to Wire.begin() would have won. But some recent changes in the ESP Arduino framework no longer allow this. In other words the second call to Wire.begin() simply gets ignored now.

        Thanks
        Felix

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

        1 Reply Last reply Reply Quote 0
        • J
          jhashe
          last edited by

          Hello Felmue
          Thank’s for your answer.
          Sorry for this newbie question, but I didn’t integrate the source code but used then Unit-Env library,
          So do I should create the .h and .cpp files for all sources (width the update you propose) and it will replace the default library ?
          Or maybe it would be better to uninstall it first ?

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

            Hello @jhashe

            using the Unit-Env library is fine - no need to uninstall it. What I suggest is for you to modify the file inside the library.

            As an alternative to modifying the library you could try to first end I2C with the incorrect GPIOs and then re-start it again with the correct GPIOs in setup() like this:

            Wire.end();
            Wire.begin(0, 26);
            

            Note: both solutions are untested as I do not have the ENVIII hat (or unit).

            Thanks
            Felix

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

            1 Reply Last reply Reply Quote 0
            • J
              jhashe
              last edited by

              Thank’s you
              I can’t try today, but will make a feedback…positive I hope :-)
              Jérôme
              (Ps: and thanks you very much Felix)

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

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • J
                  jhashe
                  last edited by jhashe

                  Wow, amazing !
                  I just added the 2 lines you suggested in the setup function of the program (no need to modify the library) and it works.

                  Wire.end();
                  Wire.begin(0, 26);

                  A great thanks for your rapid and effective help

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

                    Hello @jhashe

                    you are very welcome. An thank you for reporting back. I am glad to hear you got it working to your liking.

                    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