Can I change the pins for scl and sda

I have adafruits SSD1306 library that I would like to use to run a nano driving a SSd1306 with I2C.

The sketch says the SCL and SDA pins are defined by the wire library.

Is it possible to change the pins? I can’t find the wire library on my computer though the sketch compiles so it must be there somewhere

1 Like

Why do you want to change the pins ?

I have already used the pins a4 and a5 for something else and it would be easier to change the pins in software than alter my project

I think that you are going to be out of luck because the chip pins for I2C are fixed

However, there is a chance that you could use software I2C for which I believe there is a library available

They are defined by the MCU. The Wire library default is to use the pins in the Arduino board definition that you selected for compiling and uploading.

There are several different software I2C libraries for Arduino, which can make use any available digital pins. A web search will find them.

Then change the pins of the devices using A4 and A5. "Change" goes both ways.

As you have seen, then no that would not be the easiest way to do things. Basically you made a mistake in using these pins in the first place. Just swallow that fact and rearrange those pins so they are not used for something else.

Using software I2C drivers are a poor choice because they don't always work on the full I2C specification. First they are slower and second they don't always have the same pulse stretching capabilities a real I2C circuit has.

The alternative is to use a processor that's got two I2C busses in the first place.

The best advice you are going to get is in reply#6. Surprisingly, libraries for software I2C do exist but that doesn't mean they are a good idea. Indeed, possibly a rather bad one, as you could find yourself paying a steep price to use them, like with software serial. This is not a topic you should share with your mother.......

Which of the 20+ models? It may be possible to move the i2c pins on some of them.

OK thanks.