Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed wave_player Servo 4DGL-uLCD-SE Motor SDFileSystem LSM9DS1_Library_cal PinDetect X_NUCLEO_53L0A1
part13.h
00001 #include "mbed.h" 00002 #include "SDFileSystem.h" 00003 00004 SDFileSystem sd(p5, p6, p7, p8, "sd"); 00005 00006 int run_part13() { 00007 mkdir("/sd/mydir", 0777); 00008 00009 FILE *fp = fopen("/sd/mydir/sdtest.txt", "w"); 00010 if(fp == NULL) { 00011 error("Could not open file for write\n"); 00012 } 00013 fprintf(fp, "Hello fun SD file world!"); 00014 fclose(fp); 00015 00016 char mystring[100]; 00017 FILE *fp2 = fopen("/sd/mydir/sdtest.txt", "r"); 00018 if (fgets(mystring, 100, fp) != NULL) { 00019 printf(mystring); 00020 } 00021 fclose(fp); 00022 00023 return 0; 00024 }
Generated on Mon Jul 18 2022 11:06:52 by
1.7.2