White Wizard micro SD Card module test program.You can use White Wizard SPI system easily! Details : http://wizard.nestegg.jp/sd.html

Dependencies:   mbed

Committer:
halfpitch
Date:
Wed Aug 31 15:32:09 2011 +0000
Revision:
1:731d34c1b57d
Parent:
0:b8ab9a03a28d
Rev.B

Who changed what in which revision?

UserRevisionLine numberNew contents of line
halfpitch 0:b8ab9a03a28d 1 #include "mbed.h"
halfpitch 0:b8ab9a03a28d 2 #include "SDFileSystem.h"
halfpitch 0:b8ab9a03a28d 3
halfpitch 0:b8ab9a03a28d 4 SDFileSystem sd(p5, p6, p7, p8, "sd");
halfpitch 0:b8ab9a03a28d 5
halfpitch 0:b8ab9a03a28d 6 int main() {
halfpitch 0:b8ab9a03a28d 7
halfpitch 0:b8ab9a03a28d 8 //channel No must be A4 A3 A2 A1
halfpitch 0:b8ab9a03a28d 9 sd.SetCh(0x05); //channel No 0101(=0x05), depend on your SPI module setting. (1:High 0:Low)
halfpitch 0:b8ab9a03a28d 10
halfpitch 0:b8ab9a03a28d 11 printf("Hello World!\n");
halfpitch 0:b8ab9a03a28d 12
halfpitch 0:b8ab9a03a28d 13 FILE *fp = fopen("/sd/sdtest.txt", "w");
halfpitch 0:b8ab9a03a28d 14 if(fp == NULL) {
halfpitch 0:b8ab9a03a28d 15 error("Could not open file for write\n");
halfpitch 0:b8ab9a03a28d 16 }
halfpitch 0:b8ab9a03a28d 17 fprintf(fp, "Hello fun SD Card World!");
halfpitch 0:b8ab9a03a28d 18 fclose(fp);
halfpitch 0:b8ab9a03a28d 19
halfpitch 0:b8ab9a03a28d 20 printf("Goodbye World!\n");
halfpitch 0:b8ab9a03a28d 21 }