Seeed Studio SD card V4.0 shield with the Freescale KL25Z platform.
Dependencies: SDFileSystem mbed
Fork of SDFileSystem_HelloWorld by
main.cpp
00001 #include "mbed.h" 00002 #include "SDFileSystem.h" 00003 00004 /* 00005 FRDM KL25Z with Seeed SD Card Shield V4 00006 Connections have to be added between the SD Card Shield 00007 digital connector pins and the SPI connector pins as follows: 00008 Signal Digital SPI 00009 MOSI D11 4 00010 MISO D12 1 00011 SCK D13 3 00012 /CS D4 00013 */ 00014 00015 //SDFileSystem sd(PTD2, PTD3, PTD1, PTA4, "sd"); // MOSI, MISO, SCK, CS 00016 SDFileSystem sd(D11, D12, D13, D4, "sd"); // MOSI, MISO, SCK, CS 00017 Serial pc(USBTX, USBRX); 00018 00019 int main() { 00020 pc.printf("Hello World!\n"); 00021 00022 mkdir("/sd/mydir", 0777); 00023 00024 FILE *fp = fopen("/sd/mydir/sdtest.txt", "w"); 00025 if(fp == NULL) { 00026 pc.printf("Could not open file for write\n"); 00027 } 00028 fprintf(fp, "Hello fun SD Card World!"); 00029 fclose(fp); 00030 00031 pc.printf("Goodbye World!\n"); 00032 }
Generated on Wed Jul 13 2022 23:44:04 by 1.7.2