Boron use optocoupler on SDA/D0 and SCL/D1

boron
Tags: #<Tag:0x00007fe21fc447b8>

#1

Hello are there problem if I connect a optocoupler to SDA as D0 (digital output) or SLC as D1
Thanks Valentino


#2

The values for SDA/SCL are exactly the same as D0/D1 so they can be used interchangably.

Whether you write pinMode(SDA, OUTPUT) or pinMode(D0, OUTPUT) makes no difference whatsoever - both “macros” will be expanded to 0 by the preprocessor and the compiler will never know what you had written in the first place.

And yes, you can use these pins as digital IO just as you would do with any other GPIO pin.
But if you still want to use these pins as I2C interface with optocouplers in line special considerations have to be taken.


I changed the topic title as the original (“Boron use SDA or SLC as D0 and D1”) didn’t really tell the entire story.