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).