@@ -61,15 +61,20 @@ void setup() {
61
61
while (!Serial);
62
62
63
63
// Mount the USB storage
64
- usbStorage.begin ();
65
- Serial.println (" USB storage mounted." );
64
+ if (usbStorage.begin ()){
65
+ Serial.println (" USB storage mounted." );
66
+ } else {
67
+ Serial.println (errno);
68
+ }
66
69
67
70
// Mount the internal storage
68
- Serial.println (" Reformatting internal storage to make sure we have a clean FS" );
69
- internalStorage.format ();
70
-
71
- internalStorage.begin ();
72
- Serial.println (" Internal storage mounted." );
71
+ // Serial.println("Reformatting internal storage to make sure we have a clean FS");
72
+ // internalStorage.format();
73
+ if (internalStorage.begin ()){
74
+ Serial.println (" Internal storage mounted." );
75
+ } else {
76
+ Serial.println (errno);
77
+ }
73
78
74
79
// Create a root directory in the internal storage
75
80
Folder root = internalStorage.getRootFolder ();
@@ -80,6 +85,7 @@ void setup() {
80
85
81
86
// Write "Hello World!" inside file.txt
82
87
file.write (" Hello, world!" );
88
+ file.close ();
83
89
84
90
// Copy the file from internal storage to USB storage
85
91
bool success = file.copyTo (usbStorage.getRootFolder ());
@@ -100,8 +106,8 @@ void setup() {
100
106
}
101
107
102
108
// Print contents of the USB storage
103
- Serial.println (" USB storage contents:" );
104
- printFolderContents (usbStorage.getRootFolder ());
109
+ // Serial.println("USB storage contents:");
110
+ // printFolderContents(usbStorage.getRootFolder());
105
111
106
112
// Print contents of the internal storage
107
113
Serial.println (" Internal storage contents:" );
0 commit comments