#include <SPI.h>
#include <SD.h>
File myFile;
void setup()
{
Serial.begin(9600);
if (!SD.begin(10))
{
Serial.println("SD card initialization failed!");
return;
}
myFile = SD.open("test.txt", FILE_WRITE);
if (myFile)
{
Serial.println("Writing to the file...");
myFile.println("Hello, world!");
myFile.close();
}
else
{
Serial.println("Error opening the file!");
}
}
void loop() {}