What I'm wondering about is if multiple I2C-based adafruit shields can
work together. I know in theory they should, but as I understand it
that depends on each using a different ID on the bus. I don't see the
ID listed on the product pages for the Data Logger Shield and for the
LCD Shield Kit. Can these two shields be "stacked"?
I2C shield stacking question
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: I2C shield stacking question
Yes, you can stack these shields.
- unwin
- Posts: 16
- Joined: Tue Apr 05, 2011 12:53 pm
Re: I2C shield stacking question
Thank you for the reply! How is the I2C address set? I couldn't find information about it on the product page and I'd like to know the specifics so I can make reasonable decisions in the future about which work together without having to post about it each time. Thank you.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: I2C shield stacking question
The 7-bit i2c address for the DS1307 is fixed at 1101000. The MCP23017 used in the RGB-LCD shield has a base address of 010000. The lower 3 address bits are configurable on the chip - but all are pulled low on the shield.
http://pdfserv.maxim-ic.com/en/ds/DS1307.pdf
http://www.adafruit.com/datasheets/mcp23017.pdf
http://pdfserv.maxim-ic.com/en/ds/DS1307.pdf
http://www.adafruit.com/datasheets/mcp23017.pdf
- unwin
- Posts: 16
- Joined: Tue Apr 05, 2011 12:53 pm
Re: I2C shield stacking question
Perfect, thank you!
-
- Posts: 4
- Joined: Thu Nov 08, 2012 5:22 pm
Re: I2C shield stacking question
I am having the exact same issue and was happy to find this post. I could really use some clarification or a more detailed explanation about stacking these two ic2 shields. The examples for the RGB LCD shield and the DS1307 both work perfectly when run individually but I cannot get them to work together. When compiling I get the following message:
I could really use some help.In file included from clockRTC.cpp:8:
C:\~\arduino-1.0.1\libraries\RTClib_Master/RTClib.h:17: error: expected unqualified-id before '/' token
C:\~\arduino-1.0.1\libraries\RTClib_Master/RTClib.h:17: error: expected `)' before '/' toke
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: I2C shield stacking question
@MrTy - Can you post your sketch?
-
- Posts: 4
- Joined: Thu Nov 08, 2012 5:22 pm
Re: I2C shield stacking question
Code: Select all
#include <Time.h>
#include <TimeAlarms.h>
#include <LiquidCrystal.h>
#include <MenuBackend.h>
#include <Wire.h>
#include <Adafruit_MCP23017.h>
#include <Adafruit_RGBLCDShield.h>
#include <RTClib.h>
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
void setup(){
}
void loop(){
}
Even without code, there is still a compiling error.
Also while I have your attention, I'm looking how to adjust the RTC clock DS1307 using buttons on the adafruit RGBLCD shield. I think it should be something like...In file included from clockRTC.cpp:8:
C:\~\arduino-1.0.1\libraries\RTClib_Master/RTClib.h:17: error: expected unqualified-id before '/' token
C:\~\arduino-1.0.1\libraries\RTClib_Master/RTClib.h:17: error: expected `)' before '/' token
C:\~\arduino-1.0.1\libraries\RTClib_Master/RTClib.h:17: error: expected `)' before '/' token
C:\~\arduino-1.0.1\libraries\RTClib_Master/RTClib.h:17: error: expected `)' before '/' token
Code: Select all
if (lcd.readButtons == BUTTON_UP){
RTC.adjust( +1min/-1min):
}
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: I2C shield stacking question
That's a lot of library includes. You probably don't need them all. I suspect you may have some conflict between Time.h and the RTC library. The RTC lib should have all the time manipulation function you need.
To adjust the time by one minute, get the current time in "unixtime" and add or subtract 60 seconds:
To adjust the time by one minute, get the current time in "unixtime" and add or subtract 60 seconds:
Code: Select all
DateTime now = RTC.now();
DateTime future (now.unixtime() + 60);
RTC.adjust(future);
Please be positive and constructive with your questions and comments.