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 SDFileSystem_HelloWorld by
main.cpp
00001 #include "mbed.h" 00002 #include "SDFileSystem.h" 00003 00004 /* 00005 LPC1114FN28 with SD Card Test 00006 digital connector pins and the SPI connector pins as follows: 00007 Signal PIN 00008 MOSI dp2 00009 MISO dp1 00010 SCK dp6 00011 /CS dp4 00012 */ 00013 00014 SDFileSystem sd(dp2, dp1, dp6, dp4, "sd"); // the pinout on the mbed Cool Components workshop board 00015 Serial uart(dp16, dp15); // UART .. P1_7: TX (pin 16), P1_6: RX (pin 15) 00016 00017 int main() 00018 { 00019 uart.baud(115200); // Baud rate 00020 uart.printf("Hello World!\r\n"); 00021 00022 mkdir("/sd/mydir", 0777); 00023 00024 FILE *fp = fopen("/sd/mydir/sdtest.txt", "w"); 00025 if(fp == NULL) { 00026 uart.printf("Could not open file for write\r\n"); 00027 exit(1); 00028 } 00029 for (int i=0; i<100; i++) { 00030 fprintf(fp, "Hello fun SD Card World! :: NO %d\r\n",i); 00031 } 00032 fclose(fp); 00033 00034 uart.printf("Goodbye World!\r\n"); 00035 00036 return 0; 00037 }
Generated on Mon Aug 29 2022 21:49:04 by
1.7.2
