I just want to share that I am able to share SCL1,SDA1 pin between RTC clock using Adafruit RTClib.h library with their RGBLCDShield. I did have to do modification as everyone mention in the other posts. What I think is lacking is for someone to actually clearly setup an entire code for someone to see. I am a novice so when reading "just change Wire to Wire1" and go to this folder and include this and that. It is very difficult, anyway I am able to put together some instruction here with hope it may be useful for someone. Originally the RTC clock using RTClib.h by default can only be used on SDA(20) and SCL (21). However, I want to be able to share this with SDA1 and SCL1 pin on the Due. What is the point of having i2C if each device use their own pins right? Anyway, because the built-in SDA1 and SCL1 have no pull up resistors, these will be the one to use according to the posts I read so far. Luckily the RTC clock and RGBLCDShield already has built in pull up resistors. The connection I used are simple, From the shields or DS1307-RTC I just feed them through a bi-level i2C safe board (I bought mine from Adafruit) and the output side I connect the 2 SCLs together and 2 SDAs together and feed them to the SCL1, SDA1 of the Due. I will try to update this with more detail connection if needed but my intent at the moment is to share the modification to the library files in order to make them work.
Step 1: Copy the Library Files
I copy RTClib folder in my Arduino library folder ( I am using MAC). and copy it in the same library folder with the name RTClib1
Step 2: Rename the Library Files
Rename the 2 files under that RTClib1 folder so you would have these 2 names RTClib1.cpp and RTClib1.h
Step 3: Edit the Cpp File
Step 3. Edit the RTClib1.cpp using text editor and here is what it looks like for me be
#define DS1307_ADDRESS 0x68
#define SECONDS_PER_DAY 86400L
Step 4: Change the Code
Change the 3rd and insert a new 4th line to look like :
#include <Wire.h> // keep this don't delete
#include <avr/pgmspace.h>// no change on this line
#include <RTClib1.h> // this is to match the name of the library and use <> instead of “”
extern TwoWire Wire1; // insert this line is the modification to include Wire1 ....
Step 5: Search-replace Wire to Wire1
Step 5. Now still in the RTClib1.cpp use search and replace feature for the word Wire to Wire1. Make sure you do not change the "extern TwoWire" you add above. There is no change needed in RTClib.h other than renaming that file to RTClib1.h
Step 6: Modify Your Arduino Ino Code
Okay, now to the ion file or the Arduino IDE code that you use that you will download. Here are what mine look like :
#include Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
#define WHITE 0x7
#include "RTClib1.h" // a modified version of RTClib.h from Adafruit to force the Due to use Wire1 instead of Wire RTC_DS1307 rtc; //this stay the same as instructed in the tutorial ...
The rests of the code here can be kept similar to their tutorials or whatever you want to do with it. Notice that the only place that you want to make sure is when you include the library RTClib1, make sure you include RCTlib1.h not RTClib.h (by the way I am not sure why sometime they use "" and sometime <> when including libraries) The examples I included are not my finished project but the intent here is so that you can see how to combine them on the same i2C bus. When the actual project is complete, I'll make another i-bles. Cheers.