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: mbed WS2813 PixelArray SDFileSystem ds3231
Fork of SDFileSystem_HelloWorld by
Diff: main.cpp
- Revision:
- 19:ae979143c796
- Parent:
- 17:e5b7469082c8
- Child:
- 20:ec1c4f02d50e
--- a/main.cpp Thu Nov 26 16:25:46 2015 +0000
+++ b/main.cpp Tue Dec 08 16:14:07 2015 +0000
@@ -79,8 +79,22 @@
//Wait for the button to be pressed
while(button);
+ //Make sure a card is present
+ if (!sd.card_present()) {
+ printf("\nNo card present!\n");
+ continue;
+ }
+
+ //Try to mount the SD card
+ printf("\nMounting SD card...");
+ if (sd.mount() != 0) {
+ printf("failed!\n");
+ continue;
+ }
+ printf("success!\n");
+
//Display the card type
- printf("\nCard type: ");
+ printf("\tCard type: ");
SDFileSystem::CardType cardType = sd.card_type();
if (cardType == SDFileSystem::CARD_NONE)
printf("None\n");
@@ -93,17 +107,9 @@
else
printf("Unknown\n");
- //Try to mount the SD card
- printf("Mounting SD card...");
- if (sd.mount() != 0) {
- printf("failed!\n");
- continue;
- }
- printf("success!\n");
-
//Display the card capacity
- printf("Sectors: %llu\n", sd.disk_sectors());
- printf("Capacity: %.1fMB\n", sd.disk_sectors() / 2048.0);
+ printf("\tSectors: %llu\n", sd.disk_sectors());
+ printf("\tCapacity: %.1fMB\n", sd.disk_sectors() / 2048.0);
/*//Format the card
printf("Formatting SD card...");
