Wire library I/O pins used?

I'm developing a sketch which uses the I2C bus with pins 17 and 16 on a Uno R3. The I2C I/O is working fine with the real time clock DS3231 as well as PIO device PCF8574.

I hit problems when I started to use A4 and A5 as simple LED outputs. The outputs are stuck high when I include execution of Wire.begin();.

I refer to the Wire library reference on this site which says that on Uno boards A4 and A5 are SDA and SCL repectively.

But I'm using the pins 16 and 17 successfully!(?)

If there are 2 busses available then how are they selected?

In anycase is there a way of freeing up A4 and A5 for GPIO when Wire library is also used?

Thanks for any help or advice...

For an Arduino Uno, the A4 is SDA and A5 is SCL. The extra pins (near the USB connector) called 'SDA' and 'SCL' are connected to A4 and A5.

As soon as you call Wire.begin(), the A4 and A5 turn into I2C mode, and you can not use them for something else.

This page shows all the functions of the pins : https://www.arduino.cc/en/Hacking/PinMapping168/ As you can see, the pin PC4 is a digital pin (PC4), a analog pin (ADC4 = A4) and also SDA for I2C and also a interrupt PCINT12.

It is not possible to have I2C devices connected and still use SDA and SCL for something else. If you remove all the I2C devices and call Wire.end(), you might use the pins for something else.

By the way, I always refer to those pins as A4 and A5, not as 16 and 17, because the label on the Arduino board says 'A4' and 'A5'.

Many thanks for pointing that out. It's a little strange to me that 16,17 and A4,A5 appear on the pin header as though they are separate but in fact are connected! Anyhow I can move forward now, so thanks again!