Changing the I2C PIN

Hi community, i'm a new programmer in this area.. It's very important and this tecnology has an incredible shield of aplicattion.. I'm doing a project that involucred the communication I2C with the micro-controller ATMega328, but ihave a problem.. This porject require many analog's in and i had to use one pin from I2C for one of this analog's entry.. My question is if i can by software modified this pines and use anothe pin.. For example change A4 and A5 to PB1 and PB2?

No, that's not possible. The I²C and ADC pins are fixed.

Pieter

Hi Pieter, that was my first impression but i read very post where some users modified the library Wire.h, especified the Wire.begin() and assigned new pines by this communication by the ESP8266 (this board don't have the I2C native). So by this possibilitty i think if was possible by my project.

It is not possible to change the hardware I2C pins. I have seen (but never used) software I2C implementations. Google "arduino software I2C". I don't know how well those libraries might work, but maybe you can find one that fits your usage.

Thank's for the link.. Is just that i found..¡¡ :slight_smile:

HI community.. i found the library to change the pines I2C at atmega328.. but when i started to do test with my lcd 16x2 I2C appear this error and is a declaration normally used by the library softwire.. If someone can help me..¡ :confused:

edgarmontoya985:
If someone can help me.

Sure we can help you. Please read How to use this forum at the top of every forum, then ask your question in a way that will help us to help you.

Error conflicting declaration "SoftWire Wire"

HI community.. i found the library to change the pines I2C at atmega328.. but when i started to do test with my lcd 16x2 I2C appear this error and is a declaration normally used by the library softwire.. If someone can help me..¡ :confused:

How many times did you cross-post? ... Looks like four. Don't do that again.

edgarmontoya985:
Error conflicting declaration "SoftWire Wire"

HI community.. i found the library to change the pines I2C at atmega328.. but when i started to do test with my lcd 16x2 I2C appear this error and is a declaration normally used by the library softwire.. If someone can help me..¡ :confused:

You can use any valid DPins as SSDA/SSCL (Soft SDA/Soft SCL) lines by including this Library :SoftwareWire.h. However, you will not be able to operate I2CLCD that needs this Library: LiquidCrystal_I2C.h as the said library uses Wire.h Library which uses A4/A5 as Hard SDA/Hard SCL lines.

This thread has a discussion that contains instuctions on how to use the SoftwareWire with the hd44780 library for LCDs.

Hello,

Wouldn't it be more interesting to use an analog multiplexer? I think a software I2C will never be as good as a "hardware" one...

The library isn't work well with the modifications.. I discarted this option and work with the native pines by this communications.. Thanks every one ¡ :slight_smile: