GPS + Logging
Dependencies: FatFileSystem MBed_Adafruit-GPS-Library mbed
Fork of SDHCFileSystem by
main.cpp@1:fe331bb498a0, 2015-11-03 (annotated)
- Committer:
- nikhilesh1992
- Date:
- Tue Nov 03 01:58:12 2015 +0000
- Revision:
- 1:fe331bb498a0
- Parent:
- 0:90601632692f
- Child:
- 2:d5500685a878
Sd card working
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
xxll | 0:90601632692f | 1 | #include "mbed.h" |
xxll | 0:90601632692f | 2 | #include "string" |
xxll | 0:90601632692f | 3 | #include "SDHCFileSystem.h" |
xxll | 0:90601632692f | 4 | |
xxll | 0:90601632692f | 5 | SDFileSystem sd(p5, p6, p7, p8, "sd"); // mosi, miso, sclk, cs |
xxll | 0:90601632692f | 6 | |
xxll | 0:90601632692f | 7 | int main() { |
nikhilesh1992 | 1:fe331bb498a0 | 8 | unsigned char c; |
nikhilesh1992 | 1:fe331bb498a0 | 9 | printf("Hello World!\n"); |
nikhilesh1992 | 1:fe331bb498a0 | 10 | |
nikhilesh1992 | 1:fe331bb498a0 | 11 | mkdir("/sd/mydir", 0777); |
nikhilesh1992 | 1:fe331bb498a0 | 12 | |
nikhilesh1992 | 1:fe331bb498a0 | 13 | FILE *fp = fopen("/sd/mydir/sdtest.txt", "r"); |
nikhilesh1992 | 1:fe331bb498a0 | 14 | if(fp == NULL) { |
nikhilesh1992 | 1:fe331bb498a0 | 15 | error("Could not open file for write\n"); |
nikhilesh1992 | 1:fe331bb498a0 | 16 | } |
nikhilesh1992 | 1:fe331bb498a0 | 17 | //fprintf(fp, "Hello fun SD Card World!"); |
nikhilesh1992 | 1:fe331bb498a0 | 18 | while(!feof(fp)){ |
nikhilesh1992 | 1:fe331bb498a0 | 19 | c = getc(fp); |
nikhilesh1992 | 1:fe331bb498a0 | 20 | printf("%c", c); |
nikhilesh1992 | 1:fe331bb498a0 | 21 | } |
nikhilesh1992 | 1:fe331bb498a0 | 22 | fclose(fp); |
nikhilesh1992 | 1:fe331bb498a0 | 23 | printf("Goodbye World!\n"); |
xxll | 0:90601632692f | 24 | } |