I have an ADXL345 accelerometer on a Makershield stacked on top of a Seeed SD card shield. Both of those are stacked on an Arduino UNO R2.
I've got each working individually, but when stacked they share pin 12. The SD Card shield uses 12 for MISO of SPI and the ADXL345 uses it for SDO/Alt address.
I'm new to Arduino and have not stacked shields like this before. I'm not sure what the best course of action is here to get them both working, Ultimately, I want to log the data from the accelerometer to the SD card, but first things first!
I'd be grateful for any help. I've linked the data sheets for the ADXL345 and the SD shield above.
Best Answer
It shouldn't be a problem. The Chipselect of the accelerometer is pin 10, and that of the SD card shield is 7.
Which means that you can use one board at a time, as long as you set its chipselect to HIGH once you're done with it.
Basically, the usual code for accessing the accelerometer is like this (from here, just the relevant parts):
Note that the CSa pin is made LOW before reading/writing, and it is set to HIGH once you're done with it.
Make sure that you do the same for the chipselect for the SD card shield -- keep its chipselect on HIGH when not in use, and on LOW only for the duration of time when you want to communicate with it.