LCD 2004 with RTC clock

Hi I have the SainSmart LCD 20x4 with YwRobot shied on the back It connects to pins 4 and 5 SDA and SCL

But I also have and RTC clock which also uses SCA and SCL for pins 4 and 5 how can I use both

Thanks in advance

Yes, you can use both, because each device has its own address.

Look here for I2C scanner and LCD RTC clock

The missing piece of information may be that i2c is a bus and not seperate lines like async serial. So you hook all the SCL lines together and all the SDA lines together. Just make sure that you have the pullups on SCL and SDA lines as it is required by the spec and you may have issues without them since there will be multiple slaves.

--- bill

Since you were not aware of the above it might be appropriate to ask if you know which library you should use for the LCD ?

My suggestion for the i2c LCD library would be to use fm's library. https://bitbucket.org/fmalpartida/new-liquidcrystal The constructor for the sainsmart/ywrobot/dfrobot/funduino i2c backpacks I've seen is: 2,1,0,4,5,6,7,3,POSITIVE All those backpacks use the same wiring.

--- bill

Do you know how to use the info Bill just gave you ?