Write 10 lines of Accelerometer data from FRDM-KL25Z to SD Card and read it back.
Dependencies: MMA8451Q SDFileSystem mbed
Fork of SDCardTest by
main.cpp@1:2dec995d53f8, 2009-12-14 (annotated)
- Committer:
- simon
- Date:
- Mon Dec 14 20:31:54 2009 +0000
- Revision:
- 1:2dec995d53f8
- Parent:
- 0:666a082cf50f
- Child:
- 3:68ef62208d4d
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
simon | 0:666a082cf50f | 1 | #include "mbed.h" |
simon | 0:666a082cf50f | 2 | #include "SDFileSystem.h" |
simon | 0:666a082cf50f | 3 | |
simon | 1:2dec995d53f8 | 4 | SDFileSystem sd(p11, p12, p13, p27, "sd"); |
simon | 0:666a082cf50f | 5 | |
simon | 0:666a082cf50f | 6 | int main() { |
simon | 0:666a082cf50f | 7 | printf("Hello World!\n"); |
simon | 0:666a082cf50f | 8 | |
simon | 0:666a082cf50f | 9 | FILE *fp = fopen("/sd/sdtest.txt", "w"); |
simon | 0:666a082cf50f | 10 | if(fp == NULL) { |
simon | 0:666a082cf50f | 11 | error("Could not open file for write\n"); |
simon | 0:666a082cf50f | 12 | } |
simon | 0:666a082cf50f | 13 | fprintf(fp, "Hello SD Card World!"); |
simon | 0:666a082cf50f | 14 | fclose(fp); |
simon | 0:666a082cf50f | 15 | |
simon | 0:666a082cf50f | 16 | printf("Goodbye World!\n"); |
simon | 0:666a082cf50f | 17 | } |