#include <SD.h>

File myFile;

String dataLine;
void setup()
{
  Serial.begin(9600);
  Serial.print(F("Iniciando SD ..."));
  if (!SD.begin(9))
  {
    Serial.println(F("Error al iniciar"));
    return;
  }
  Serial.println(F("Iniciado correctamente"));
 SD.mkdir("adios");

 myFile = SD.open("p1", FILE_WRITE); 
 if (myFile) {

    Serial.print("Writing to test.txt...");

    myFile.println("testing 1, 2, 3.");

    // close the file:

    myFile.close();

    Serial.println("done.");

  } else {

    // if the file didn't open, print an error:

    Serial.println("error opening test.txt");

  }
 myFile = SD.open("p1"); 


 
  if (dataLine){
 
     while (myFile.available()) {
       // myFile.write("hola capullo");
        Serial.println( myFile(dataLine));  // En un caso real se realizarían las acciones oportunas
      }
    myFile.close();
  }
  else 
  {
    Serial.println(F("Error al abrir el archivo"));
  }
  
}

void loop()
{
}

