Skip to content

Commit 4d02d9b

Browse files
authored
Update ReadWrite.ino (#73) - Better debugging information when failing to init SD card
* Update ReadWrite.ino * fix SdFat.h formatting * fix ReadWrite.ino formatting
1 parent 86731b2 commit 4d02d9b

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

examples/ReadWrite/ReadWrite.ino

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,14 @@ void setup() {
3434
Serial.print("Initializing SD card...");
3535

3636
if (!SD.begin(4)) {
37-
Serial.println("initialization failed!");
37+
Serial.println("initialization failed. Things to check:");
38+
Serial.println("1. is a card inserted?");
39+
Serial.println("2. is your wiring correct?");
40+
Serial.println("3. did you change the chipSelect pin to match your shield or module?");
41+
Serial.println("Note: press reset or reopen this serial monitor after fixing your issue!");
3842
while (1);
3943
}
44+
4045
Serial.println("initialization done.");
4146

4247
// open the file. note that only one file can be open at a time,

src/utility/SdFat.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ class SdVolume;
4141
// SdFile class
4242

4343
#ifdef O_RDONLY //ARDUINO_ARCH_MBED
44-
#undef O_READ
45-
#undef O_RDONLY
46-
#undef O_WRITE
47-
#undef O_WRONLY
48-
#undef O_RDWR
49-
#undef O_ACCMODE
50-
#undef O_APPEND
51-
#undef O_SYNC
52-
#undef O_CREAT
53-
#undef O_EXCL
54-
#undef O_TRUNC
44+
#undef O_READ
45+
#undef O_RDONLY
46+
#undef O_WRITE
47+
#undef O_WRONLY
48+
#undef O_RDWR
49+
#undef O_ACCMODE
50+
#undef O_APPEND
51+
#undef O_SYNC
52+
#undef O_CREAT
53+
#undef O_EXCL
54+
#undef O_TRUNC
5555
#endif
5656

5757
// flags for ls()

0 commit comments

Comments
 (0)