Chuck
That all makes sense, but why can't I use pin 10?
Here's a piece of code from sd2Card.h in the SD library:
/* SD Chip Select pin
*
* Warning if this pin is redefined the hardware SS will pin will be enabled
* as an output by init(). An avr processor will not function as an SPI
* master unless SS is set to output mode.
*/
/** The default chip select pin for the SD card is SS. */
uint8_t const SD_CHIP_SELECT_PIN = SS_PIN;
I read this to say pin 53 on MEGA doubles as SS and CS, unless SD_CHIP_SELECT_PIN is redefined
I'm using Sparkfun microSD with and following:
#define CS_pin 8
if (!SD.begin(CS_pin)){
Serial << "[SD init FAILED]\n";
SD_OK = false;
lcd.setCursor(0,1); lcd.print("[SD init FAILED]"); delay(2000);}
else {root = SD.open("/"); Serial << "[SD OK]\n"; printDirectory(root, 0);}
(note my term CS_pin is not SD_CHIP_SELECT_PIN)
I assume pin 53 is "the hardware SS" and cannot be changed on a MEGA.
I've tested with and without following in my code and it makes no difference to SD functionality
# define SS_pin 53
pinMode(SS_pin, OUTPUT);
and either way pin 10 seems to be unavailable for other non-SD tasks.
(again my term SS_pin does not override SS_PIN in the library)
Now I don't bother making pin 53 an output, because it seems to be done for me.
Still not quite adding up!