I purchased the SD Card Shield (Adafruit PN: 254). The default connection pins (Mega 2650 R3) are 10, 11, 12 and 13. I have another device that is also hard coded to use pins 10 and 11.
I have browsed nearly every code file associated with the SD cards and SPI functions, but don't see how I am to change these default pin locations.
Is it possible? ...and if so, which library or file needs to be altered? I would like then to be moved to pins 24, 25, 26 and 27 (if possible).
I thank you in advance for your reply!
Ken
SD/Arduino Change default pins
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: SD/Arduino Change default pins
In your call to SD.begin, specify the pins you want to use. Pins are specified in the following order:
CS (Chip Select), MOSI, MISO, SCK
CS (Chip Select), MOSI, MISO, SCK
Code: Select all
SD.begin(24, 25, 26, 27)
- IDONTNODOU
- Posts: 3
- Joined: Tue Feb 18, 2020 10:16 pm
Re: SD/Arduino Change default pins
Thanks for your quick reply... I didn't see that call in the examples I looked at (I must have just overlooked them, I assume they are there.) I felt they were hard-coded within the libraries.
THANKS!
Ken
THANKS!
Ken
- IDONTNODOU
- Posts: 3
- Joined: Tue Feb 18, 2020 10:16 pm
Re: SD/Arduino Change default pins
Bill:
Which library are you using that accepts that 'begin' code? I have tried that several times trying the different libraries I have found for SD readers, and none of them accept 4 arguments.
....Still trying to get any card or library to actually read/write. Not having any success.
Any additional information will be appreciated!
Ken
Which library are you using that accepts that 'begin' code? I have tried that several times trying the different libraries I have found for SD readers, and none of them accept 4 arguments.
....Still trying to get any card or library to actually read/write. Not having any success.
Any additional information will be appreciated!
Ken
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: SD/Arduino Change default pins
This is our fork of the SD library that supports alternative pins: https://github.com/adafruit/SD
Supposedly, this functionality has also been integrated into the default Arduino library. But the Arduino documentation does not say anything about that.
https://www.arduino.cc/en/Reference/SDbegin
Supposedly, this functionality has also been integrated into the default Arduino library. But the Arduino documentation does not say anything about that.
https://www.arduino.cc/en/Reference/SDbegin
Please be positive and constructive with your questions and comments.