Thanks.
How difficult would be if I want to use digital lines?
Is it only a matter of modifying the original Wires library to manipulate digital lines instead of the ADC4/5 ports?
How difficult would be if I want to use digital lines?
Is it only a matter of modifying the original Wires library to manipulate digital lines instead of the ADC4/5 ports?
The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and the analogReference() function. Additionally, some pins have specialized functionality:
I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire library.
The ATmega's on-board I2C controller is hard wired to pins 4 and 5. This isn't an Arduino limitation. It is a ATmega trade-off.
You might be able to find (or write) a software-based I2C implementation to use different pins, but it will likely have some pretty significant trade-offs.
In my opinion, the multiplexer on the ATmega's A/D isn't all that good. Most of the trouble people have with the analog inputs are related to the built-in multiplexer. If you need more than one analog input, you might look at an external multiplexer or A/D.
I just the ATmega328P manual and, as already commented, the SDA and SCL functions are tied to the pins corresponding to ADC4 and ADC5. Therefore, it is not only a matter of making a change at the current Wires library: there is a physical constraint.
However, it does not that it is not possible to create a new library, but it would be extremely time-consuming to develop all the TWI stuff from the scratch.
I will have to deal with my problem in a different direction.