Skip to content

Commit 8c36c25

Browse files
committed
Fixed some examples to actually stop when init fails
1 parent aa44fca commit 8c36c25

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

examples/CardInfo/CardInfo.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void setup() {
5252
Serial.println("* is a card inserted?");
5353
Serial.println("* is your wiring correct?");
5454
Serial.println("* did you change the chipSelect pin to match your shield or module?");
55-
return;
55+
while (1);
5656
} else {
5757
Serial.println("Wiring is correct and a card is present.");
5858
}
@@ -77,7 +77,7 @@ void setup() {
7777
// Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32
7878
if (!volume.init(card)) {
7979
Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
80-
return;
80+
while (1);
8181
}
8282

8383
Serial.print("Clusters: ");

examples/Datalogger/Datalogger.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void setup() {
3939
if (!SD.begin(chipSelect)) {
4040
Serial.println("Card failed, or not present");
4141
// don't do anything more:
42-
return;
42+
while (1);
4343
}
4444
Serial.println("card initialized.");
4545
}

examples/DumpFile/DumpFile.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void setup() {
3939
if (!SD.begin(chipSelect)) {
4040
Serial.println("Card failed, or not present");
4141
// don't do anything more:
42-
return;
42+
while (1);
4343
}
4444
Serial.println("card initialized.");
4545

examples/Files/Files.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void setup() {
3434

3535
if (!SD.begin(4)) {
3636
Serial.println("initialization failed!");
37-
return;
37+
while (1);
3838
}
3939
Serial.println("initialization done.");
4040

examples/ReadWrite/ReadWrite.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void setup() {
3535

3636
if (!SD.begin(4)) {
3737
Serial.println("initialization failed!");
38-
return;
38+
while (1);
3939
}
4040
Serial.println("initialization done.");
4141

examples/listfiles/listfiles.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void setup() {
3737

3838
if (!SD.begin(4)) {
3939
Serial.println("initialization failed!");
40-
return;
40+
while (1);
4141
}
4242
Serial.println("initialization done.");
4343

0 commit comments

Comments
 (0)