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@3:68ef62208d4d, 2009-12-31 (annotated)
- Committer:
- simon
- Date:
- Thu Dec 31 15:11:08 2009 +0000
- Revision:
- 3:68ef62208d4d
- Parent:
- 1:2dec995d53f8
- Child:
- 4:823307a8e5dc
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 | 3:68ef62208d4d | 13 | fprintf(fp, "Hello fun 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 | } |