Go Down

Topic: Read File content on Sd card mount on yun (Read 699 times) previous topic - next topic

Shinyhero

Hello Everyone i am making this post because i've got a question how can i read the content of a file with arduino:
here is the code:
Code: [Select]

void LectureSd(){
  File dataFile = FileSystem.open("/mnt/sd/arduino/www/test/registre1.json", FILE_READ);
  if(dataFile){
    /********lecture du contenu du fichier*********/
  } else {
    Serial.println("Erreur lecture du fichier");
  }
}

here is the file:
{"data":[{"nom": "leban","prenom": "gerald","jetons": "10"},{"nom": "billon","prenom": "yannis","jetons": "10"},{"nom": "valencia","prenom": "gael","jetons": "10"},{"nom": "bru","prenom": "joris","jetons": "10"},{"nom": "monteleone","prenom": "guillaume","jetons": "10"},{"nom": "verge","prenom": "alexandre","jetons": "10"},{"nom": "vidal","prenom": "cyric","jetons": "10"},{"nom": "cros","prenom": "lucas","jetons": "10"},{"nom": "ivanov","prenom": "nicky","jetons": "10"},{"nom": "lemoine","prenom": "lemoine","jetons": "10"}]}

ShapeShifter

And your question is what, exactly?

What is your ultimate goal with this project? Depending on what you're going to do with the data from the file, it might be easier to read and parse the file with code on the Linux side, and then pass the minimum amount of data to the sketch, probably using a Process object.

Go Up