I was previously using the Ethernet Sheila with the SD Card on my Mega. I changed up what I am doing and eliminated the Shield. I now have a separate MicroSD adapter which is hooked into 50-53 (I believe). So rather than the Shield utilizing 10-14 it is now on 50-53, and it is not working. What do I need to do / change to get it to work?
The SD library is written so that it defaults to using the SS pin for the SD card CS. So the SD library is automatically configured for having the SD adapter's CS pin connected to pin 53 on your Mega. However, the SD library also allows you to set the CS pin to any pin you like via SD.begin(). Since the Ethernet shield connects pin 4 to the SD CS pin, your code likely uses SD.begin() to set the CS pin to 4, something like this:
const int chipSelect = 4;
...
if (!SD.begin(chipSelect)) {
So the solution to make it work with your new wiring is either to change this line:
const int chipSelect = 4;
to:
const int chipSelect = 53;
or else to change this line:
if (!SD.begin(chipSelect)) {
to:
[code] if (!SD.begin()) {
[/code]
Stupidav:
I now have a separate MicroSD adapter which is hooked into 50-53 (I believe).
What do you mean by "I believe"? You wired the adapter to your Mega, right? So you should know what the connections are.
Thank you, I had just thought that I need to double check that.
The I believe part, was just because it is not right in front of me at this moment.