Post topics, source code that relate to the Arduino Platform

User avatar
By martinayotte
#39671 You can hook up I2C bus on almost any pins, you just need to provide pins number in the begin() function.
Personally, I'm using GPIO0/GPIO2 since they also need PullUps for boot mode, so perfect for I2C bus too.
Code: Select allWire.begin(0, 2);

But if you don't provide pins, they will be defaulted according to the board variant, Generic is 4/5.
User avatar
By shah
#39749
martinayotte wrote:You can hook up I2C bus on almost any pins, you just need to provide pins number in the begin() function.
Personally, I'm using GPIO0/GPIO2 since they also need PullUps for boot mode, so perfect for I2C bus too.
Code: Select allWire.begin(0, 2);

But if you don't provide pins, they will be defaulted according to the board variant, Generic is 4/5.


Thank you for your reply. But I don't see begin() taking GPIO pins in the function prototype. It only takes optional address of the device.
https://www.arduino.cc/en/Reference/WireBegin
Am I missing something?

bluegiraffe wrote:I've used the 1602 LCD with an I2C adapter on NodeMcu Lua and Sming, and it works fine in both.

I also use the 1.8 TFT ST7735 based TFT displays with Sming using SPI and it also works fine.


Have you got it working in Arduino or Lua? I am mainly talking about getting it to work in Arduino environment. Regardless which GPIO lines on Node MCU did you connect your SDA and SCL from your LCD? And if you got it working in Arduino, what libraries did you use? And can you share your code? Thanks.
User avatar
By WereCatf
#39751
shah wrote:Thank you for your reply. But I don't see begin() taking GPIO pins in the function prototype. It only takes optional address of the device.
https://www.arduino.cc/en/Reference/WireBegin
Am I missing something?


The ESP uses its own Wire-library ( https://github.com/esp8266/Arduino/blob ... re-library ), which does accept those arguments.