Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@0:2dbbafe1b1fb, 2011-01-23 (annotated)
- Committer:
- emh203
- Date:
- Sun Jan 23 18:35:43 2011 +0000
- Revision:
- 0:2dbbafe1b1fb
1st test version. Test with raw mbed and Samtec USB-RA type A connector wired directly to pins.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| emh203 | 0:2dbbafe1b1fb | 1 | #include "mbed.h" |
| emh203 | 0:2dbbafe1b1fb | 2 | #include "ff.h" |
| emh203 | 0:2dbbafe1b1fb | 3 | |
| emh203 | 0:2dbbafe1b1fb | 4 | DigitalOut myled(LED1); |
| emh203 | 0:2dbbafe1b1fb | 5 | Serial pc(USBTX, USBRX); |
| emh203 | 0:2dbbafe1b1fb | 6 | |
| emh203 | 0:2dbbafe1b1fb | 7 | FATFS MyFileSystem; |
| emh203 | 0:2dbbafe1b1fb | 8 | FIL MyFile; |
| emh203 | 0:2dbbafe1b1fb | 9 | |
| emh203 | 0:2dbbafe1b1fb | 10 | int main() |
| emh203 | 0:2dbbafe1b1fb | 11 | { |
| emh203 | 0:2dbbafe1b1fb | 12 | unsigned int BytesWritten; |
| emh203 | 0:2dbbafe1b1fb | 13 | |
| emh203 | 0:2dbbafe1b1fb | 14 | //mount the SD card (any drive number will map to the SD card) |
| emh203 | 0:2dbbafe1b1fb | 15 | f_mount(0,&MyFileSystem); |
| emh203 | 0:2dbbafe1b1fb | 16 | //Open the file for open and write |
| emh203 | 0:2dbbafe1b1fb | 17 | f_open(&MyFile,"Test1.2.3.4.txt",FA_WRITE|FA_OPEN_ALWAYS); |
| emh203 | 0:2dbbafe1b1fb | 18 | //Write some junk |
| emh203 | 0:2dbbafe1b1fb | 19 | f_write(&MyFile,"Testing!\r\nTesting,1,2,3\r\n",27,&BytesWritten); |
| emh203 | 0:2dbbafe1b1fb | 20 | //Close the file |
| emh203 | 0:2dbbafe1b1fb | 21 | f_close(&MyFile); |
| emh203 | 0:2dbbafe1b1fb | 22 | |
| emh203 | 0:2dbbafe1b1fb | 23 | while(1) |
| emh203 | 0:2dbbafe1b1fb | 24 | { |
| emh203 | 0:2dbbafe1b1fb | 25 | pc.printf("all done!!\r\n"); |
| emh203 | 0:2dbbafe1b1fb | 26 | wait(1); |
| emh203 | 0:2dbbafe1b1fb | 27 | myled = !myled; |
| emh203 | 0:2dbbafe1b1fb | 28 | } |
| emh203 | 0:2dbbafe1b1fb | 29 | } |