The question in short: On an Arduino UNO or Nano using the SD library, is it somehow possible to use the LED on pin 13 (or any other pin that is used by the library) again after finishing all SD operations?
Detailed explanation: In my sketch, during setup() I need to read some data from a file on the SD card, which is being closed again before leaving setup().
Now, I wanted to use the LED on pin 13 during loop() as a status indicator for the user, but it seems that after SD.begin(), pin 13 (and its LED) cannot be used as an OUTPUT anymore.
Here is a minimum sketch to show the behavior. It doesn't matter if I try to turn on the LED right after the call to SD.begin() in setup() or in loop():
#include <SD.h>
#include <SPI.h>
#define SD_CS 4
#define LED 13
void setup() {
pinMode(LED, OUTPUT);
// This still works:
digitalWrite(LED, HIGH);
delay(1000);
digitalWrite(LED, LOW);
SD.begin(SD_CS);
// This does not work anymore:
digitalWrite(LED, HIGH);
delay(1000);
digitalWrite(LED, LOW);
}
void loop() {}