Skip to content

Commit 4d3b263

Browse files
committed
bug fixes to SD library examples
1 parent 86e3d4a commit 4d3b263

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

libraries/SD/examples/Datalogger/Datalogger.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void setup()
3434
Serial.print("Initializing SD card...");
3535
// make sure that the default chip select pin is set to
3636
// output, even if you don't use it:
37-
// pinMode(10, OUTPUT);
37+
pinMode(10, OUTPUT);
3838

3939
// see if the card is present and can be initialized:
4040
if (!SD.begin(chipSelect)) {

libraries/SD/examples/Files/Files.pde

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,48 +29,50 @@ void setup()
2929
// Note that even if it's not used as the CS pin, the hardware SS pin
3030
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
3131
// or the SD library functions will not work.
32+
pinMode(10, OUTPUT);
3233

3334
if (!SD.begin(4)) {
3435
Serial.println("initialization failed!");
3536
return;
3637
}
3738
Serial.println("initialization done.");
38-
39+
3940
if (SD.exists("example.txt")) {
40-
Serial.println("example.txt exists.");
41+
Serial.println("example.txt exists.");
4142
}
4243
else {
43-
Serial.println("example.txt doesn't exist.");
44+
Serial.println("example.txt doesn't exist.");
4445
}
45-
46+
4647
// open a new file and immediately close it:
4748
Serial.println("Creating example.txt...");
48-
myFile = SD.open("example.txt", FILE_TRUNCATE);
49-
myFile.close();
50-
49+
myFile = SD.open("example.txt", FILE_TRUNCATE);
50+
myFile.close();
51+
5152
// Check to see if the file exists:
5253
if (SD.exists("example.txt")) {
53-
Serial.println("example.txt exists.");
54+
Serial.println("example.txt exists.");
5455
}
5556
else {
56-
Serial.println("example.txt doesn't exist.");
57+
Serial.println("example.txt doesn't exist.");
5758
}
58-
59+
5960
// delete the file:
6061
Serial.println("Removing example.txt...");
6162
SD.remove("example.txt");
6263

6364
if (SD.exists("example.txt")){
64-
Serial.println("example.txt exists.");
65+
Serial.println("example.txt exists.");
6566
}
6667
else {
67-
Serial.println("example.txt doesn't exist.");
68+
Serial.println("example.txt doesn't exist.");
6869
}
6970
}
7071

7172
void loop()
7273
{
73-
// nothing happens after setup finishes.
74+
// nothing happens after setup finishes.
7475
}
7576

7677

78+

libraries/SD/examples/ReadWrite/ReadWrite.pde

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ void setup()
3030
// Note that even if it's not used as the CS pin, the hardware SS pin
3131
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
3232
// or the SD library functions will not work.
33-
33+
pinMode(10, OUTPUT);
34+
3435
if (!SD.begin(4)) {
3536
Serial.println("initialization failed!");
3637
return;

0 commit comments

Comments
 (0)