Env III Hat defectuous ?
-
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 -
Hello @jhashe
Wire.begin(0, 26)
insetup()
should be correct.However there is an additional
Wire.begin()
insideM5Unit-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 toWire.begin()
simply gets ignored now.Thanks
Felix -
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 ? -
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 -
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) -
This post is deleted! -
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
-
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