# I2C pin question

**URL:** <https://forum.xod.io/t/i2c-pin-question/1064>\
**Category:** Uncategorized\
**Created:** [August 23, 2018, 10:57am UTC](https://forum.xod.io/t/i2c-pin-question/1064 "2018-08-23T10:57:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dox](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/dox/32/424_2.png) [@dox](https://forum.xod.io/u/dox)\
**Post date:** [August 23, 2018, 10:57am UTC](https://forum.xod.io/t/i2c-pin-question/1064/1 "2018-08-23T10:57:19Z")

</div>

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

![i2c](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/882d7fc83e15ee5109eb076cef3fc9b344e66dd9.jpeg)

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [August 23, 2018, 5:32pm UTC](https://forum.xod.io/t/i2c-pin-question/1064/2 "2018-08-23T17:32:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nkrkv](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/nkrkv/32/8_2.png) [@nkrkv](https://forum.xod.io/u/nkrkv)\
**Post date:** [August 24, 2018, 2:20pm UTC](https://forum.xod.io/t/i2c-pin-question/1064/3 "2018-08-24T14:20:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dox](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/dox/32/424_2.png) [@dox](https://forum.xod.io/u/dox)\
**Post date:** [August 25, 2018, 7:34pm UTC](https://forum.xod.io/t/i2c-pin-question/1064/4 "2018-08-25T19:34:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nkrkv](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/nkrkv/32/8_2.png) [@nkrkv](https://forum.xod.io/u/nkrkv)\
**Post date:** [August 27, 2018, 8:32am UTC](https://forum.xod.io/t/i2c-pin-question/1064/5 "2018-08-27T08:32:27Z")

</div>

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