Hi community! After browsing several entries in this forum I’ve been unable to find my problem: I want to install LCD (2x16) with I2C interface in Arduino smart car, where the ultrasonic sensor is predefined in A4, A5 pins; and LCD with I2C also uses A4(SDA), A5(SDL). Separate, both subsystems work perfectly.
You do know that multiple I2C devices can share pins A4 and A5 ? Important is only that they have different I2C addresses.
If you still have difficulties, post both sketches which work and your attempt to integrate the 2 devices into one sketch.
You do know that multiple I2C devices can share pins A4 and A5 ?
But OP didn’t actually say that the sensor is I2C, just that it’s tied to pins A4 and A5.
So, OP, is the sensor I2C or is just crap luck that it’s tied to the I2C’s pins?
edit… if the sensor is I2C, you can use the other pair of pins (if Uno):
. . .
edit... if the sensor is I2C, you can use the other pair of pins (if Uno):
. . .
Using the other pair of pins will only make it physically easier to connect both devices to the UNO. Any other problems will still have to be dealt with.
Many thanks for so rapid answer. I forgot to say before, that I already had managed to integrate my LCD(16,2) without the I2C interface; obviously using all the necessaire amount of wires and pins. Problem started with the I2c interface in order of saving pin connections. Picture 1, red circled shows the Arduino Uno expansion board to connect ultrasonic sensor (A4, A5). Circled in blue two pins marked as “A4/SDA, and A5/SCL” where I connect I2C interface. Circled in green we can see marked A4, A5 emerging form the main Arduino board. ¿do you suggest shall I solder a pair of pins there and use this instead of???
One of the problems with shields is that they aren't really designed to play nicely with anything else in particular.
It looks like they made a bad choice of what analog pins to use for the sonic sensor.
Your best option would be to cut the wires on the sonic sensor and connect the wire to another pair of analog pins and update whatever code you're using to use whatever analog pins you chose.
You can then hook up your LCD Display to the A4,A5,5V,GND pins on your shield instead.
Thank you bkucenski, I am evaluating this option.