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: SDFileSystem mbed
Fork of SD_ReadWrite_K64 by
Diff: main.cpp
- Revision:
- 2:b441f859191d
- Parent:
- 1:2cf8f0893afd
- Child:
- 3:a9c142f24ede
--- a/main.cpp Thu Jul 24 12:55:11 2014 +0000 +++ b/main.cpp Tue May 16 13:36:53 2017 +0000 @@ -1,42 +1,10 @@ #include "mbed.h" #include "SDFileSystem.h" - -SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd"); //mosi, miso, sclk, cs - - -#define charlimit 100 -char words[charlimit]; -int n=0,c; - -int main() { - - //writing to SD card - printf("Opening SD card...\r\n"); - - FILE *fp = fopen("/sd/test.txt", "w"); - if(fp == NULL) { - error("Could not open file for write!\r\n"); +#include <string> +#include "SD.h" +int main() +{ + while(1) { + VivesCityGame::SD read(); } - - printf("Writing to SD card...\r\n"); - fprintf(fp, "one two three four five\r\n"); - fclose(fp); - - //reading from SD card - FILE *fp1 =fopen("/sd/test.txt.", "r"); - if(fp1==NULL){ - error("Could not open file for read!\r\n"); - } - - printf("Reading from SD card...\r\n"); - - while((c=fgetc(fp1)) && c!=EOF){ - words[n]=c; - n++; - } - - printf("Read from SD card: %s",words); - - fclose(fp1); - -} +} \ No newline at end of file