I2C pin question

Why has the RTC a I2C pin and the LCD not? :thinking:
How is that pin used?

i2c

RTC maintains state by re-using the wire object contained in I2C data-type. LCD uses a library that probably does the same thing internally.

RTC also needs to share the data between read & write nodes. LCD only has 1 node & can store data in struct State.

To add to @gweimer’s reply: the I2C pin is a value of type xod/i2c/i2c. It’s an object that describes the I2C bus where given hardware is connected. It might be the hardware I²C #0, hardware I²C #1 (Mega 2560 has two I2Cs), or software I²C emulation on custom pins. If not specified the value defaults to be the hardware I²C #0.

The text-lcd-16x2-i2c is an old wrapper over a C++ library and so cannot operate over anything but I²C #0, so the choice is not provided at all. A better library would solve this problem.

Have I understood correctly that the RTC needs the additional “i2c-node” to commmunicate with the standard i2c-interface.
LCD communicates always with the standard i2c-interface and is not possible to change.
So UART-nodes like “begin”, “print”, “end” etc. need additional “uart”, “uart-0”, “uart-1”, ect. nodes depending on which serial is used on different hardware platforms.

You’re almost right. The only note to add is you may leave the an I2C (or UART) pin unlinked. In that case it uses its default:

  • For I2C the default is the standard I²C (the hardware I²C #0 seen on pins labeled SDA and SCL).
  • For UART the default is the first Serial (the hardware UART available on pins RX/0 and TX/1).