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.
Dependencies: SDFileSystem max32630fthr USBDevice
Fork of FTHR_SD_Demo by
main.cpp@6:96d8d823e292, 2017-02-06 (annotated)
- Committer:
- switches
- Date:
- Mon Feb 06 23:44:02 2017 +0000
- Revision:
- 6:96d8d823e292
- Parent:
- 4:bafcac667ef6
- Child:
- 9:36ba3626aab7
Publishing to Maxim Integrated Team
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| switches | 0:60a522ae2e35 | 1 | #include "mbed.h" |
| switches | 1:90313362ec11 | 2 | #include "max32630fthr.h" |
| switches | 1:90313362ec11 | 3 | #include "SDFileSystem.h" |
| switches | 0:60a522ae2e35 | 4 | |
| switches | 6:96d8d823e292 | 5 | MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); |
| switches | 3:247c750f9f3d | 6 | |
| switches | 1:90313362ec11 | 7 | DigitalOut rLED(LED1); |
| switches | 1:90313362ec11 | 8 | DigitalOut gLED(LED2); |
| switches | 0:60a522ae2e35 | 9 | |
| switches | 1:90313362ec11 | 10 | SDFileSystem sd(P0_5, P0_6, P0_4, P0_7, "sd"); // mosi, miso, sclk, cs |
| switches | 0:60a522ae2e35 | 11 | |
| switches | 0:60a522ae2e35 | 12 | // main() runs in its own thread in the OS |
| switches | 0:60a522ae2e35 | 13 | // (note the calls to Thread::wait below for delays) |
| switches | 0:60a522ae2e35 | 14 | int main() |
| switches | 0:60a522ae2e35 | 15 | { |
| switches | 6:96d8d823e292 | 16 | gLED = LED_ON; |
| switches | 1:90313362ec11 | 17 | rLED = LED_ON; |
| switches | 1:90313362ec11 | 18 | |
| switches | 1:90313362ec11 | 19 | FILE *fp = fopen("/sd/myfile.txt", "w"); |
| switches | 1:90313362ec11 | 20 | fprintf(fp, "Hello World!\n"); |
| switches | 1:90313362ec11 | 21 | fclose(fp); |
| switches | 1:90313362ec11 | 22 | rLED = LED_OFF; |
| switches | 0:60a522ae2e35 | 23 | |
| switches | 0:60a522ae2e35 | 24 | while (true) { |
| switches | 1:90313362ec11 | 25 | gLED = !gLED; |
| switches | 0:60a522ae2e35 | 26 | Thread::wait(500); |
| switches | 0:60a522ae2e35 | 27 | } |
| switches | 0:60a522ae2e35 | 28 | } |
| switches | 0:60a522ae2e35 | 29 |
