-->
Page 1 of 1

Using D1 and D2 for SCL and SDA, & variations of the ESP8266

PostPosted: Sun Jan 22, 2023 3:08 pm
by Stewart
I have an abundant supply of Robotdyn ESP8266-Pro modules I use for applications with I2C LCD displays.
On a LittleFS.h discussion page this morning, using a NodeMCU ESP8266 module, I noticed the author is using port D1 as SCL and D2 as SDA for his LCD display. Here https://www.hackster.io/Neutrino-1/littlefs-read-write-delete-using-esp8266-and-arduino-ide-867180

The NodeMCU pictured has the same labeled ports (D0, D1, D2, D3) as does the ESP8266-Pro module.

Could I also use the ports D1 as SCL and D2 as SDA on the ESP8266-Pro module?
And not declare which ports are to be used for the SCL and SDA?
Looks like the author's code doesn't contain a
Code: Select alllcd.begin(SDAport, SCLport);
to declare which ports are used for SCL and SDA. only the
Code: Select alllcd.init();

statement.

Re: Using D1 and D2 for SCL and SDA, & variations of the ESP

PostPosted: Mon Jan 23, 2023 4:29 am
by btidey
In NodeMCU pin numbering D1 is GPIO5 and D2 is GPIO4

By default if you don't assign specific pins when using i2c then GPIO5 is used for SCL and GPIO4 is used for SDA

Re: Using D1 and D2 for SCL and SDA, & variations of the ESP

PostPosted: Thu Jan 26, 2023 10:50 am
by Stewart
Thanks btidey