Skip to content

Commit 26a7cd1

Browse files
committed
Append changes to advanced.ino
1 parent 6cf71ea commit 26a7cd1

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

examples/AdvancedUSBInternalOperations/AdvancedUSBInternalOperations.ino

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,20 @@ void setup() {
6161
while (!Serial);
6262

6363
// 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+
}
6669

6770
// 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+
}
7378

7479
// Create a root directory in the internal storage
7580
Folder root = internalStorage.getRootFolder();
@@ -80,6 +85,7 @@ void setup() {
8085

8186
// Write "Hello World!" inside file.txt
8287
file.write("Hello, world!");
88+
file.close();
8389

8490
// Copy the file from internal storage to USB storage
8591
bool success = file.copyTo(usbStorage.getRootFolder());
@@ -100,8 +106,8 @@ void setup() {
100106
}
101107

102108
// 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());
105111

106112
// Print contents of the internal storage
107113
Serial.println("Internal storage contents:");

0 commit comments

Comments
 (0)