![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
sd lecture
eeprom_flash.cpp
- Committer:
- valentinbruchet
- Date:
- 2021-05-05
- Revision:
- 5:66c8b598de04
- Parent:
- 4:3269abcc9c73
File content as of revision 5:66c8b598de04:
#include "mbed.h" #include "SDFileSystem.h" SDFileSystem sd(PA_7, PA_6, PA_5, PB_6, "sd"); char numberstring[40]; char numberrfid[100]; int number; int number1; int main() { printf("Bienvenu!\n\r"); FILE *fp1 = fopen("/sd/valeur_rfid.txt", "r"); fgets(numberrfid, 100, fp1); if(fp1 == NULL) { error("Impossible d'ouvrir le fichier pour la lecture\n\r"); } sscanf(numberrfid, "%d", &number1); printf ("%d\n\r", number1); sscanf(numberrfid+8, "%d", &number1); printf ("%d\n\r", number1); sscanf(numberrfid+17, "%d", &number1); printf ("%d\n\r", number1); sscanf(numberrfid+25, "%d", &number1); printf ("%d\n\r", number1); sscanf(numberrfid+34, "%d", &number1); printf ("%d\n\r", number1); fclose(fp1); printf("A bientot!\n\r"); FILE *fp = fopen("/sd/valeur_temporisation.txt", "r"); fgets(numberstring, 40, fp); if(fp == NULL) { error("Impossible d'ouvrir le fichier pour la lecture\n\r"); } sscanf(numberstring, "%d", &number); printf ("%d\n\r", number); sscanf(numberstring+3, "%d", &number); printf ("%d\n\r", number); sscanf(numberstring+6, "%d", &number); printf ("%d\n\r", number); sscanf(numberstring+9, "%d", &number); printf ("%d\n\r", number); sscanf(numberstring+11, "%d", &number); printf ("%d\n\r", number); sscanf(numberstring+14, "%d", &number); printf ("%d\n\r", number); sscanf(numberstring+16, "%d", &number); printf ("%d\n\r", number); sscanf(numberstring+18, "%d", &number); printf ("%d\n\r", number); fclose(fp); printf("A bientot!\n\r"); }