1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Backported SD library from 1.5.x

This commit is contained in:
Cristian Maglie
2014-10-15 11:53:19 +02:00
parent b9b0fcdadc
commit 37115d03ef
15 changed files with 212 additions and 107 deletions

View File

@ -10,7 +10,7 @@
** MISO - pin 12
** CLK - pin 13
** CS - pin 4
created Nov 2010
by David A. Mellis
modified 9 Apr 2012
@ -19,8 +19,9 @@
by Scott Fitzgerald
This example code is in the public domain.
*/
#include <SPI.h>
#include <SD.h>
File root;
@ -29,15 +30,15 @@ void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.print("Initializing SD card...");
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
// Note that even if it's not used as the CS pin, the hardware SS pin
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
// or the SD library functions will not work.
// Note that even if it's not used as the CS pin, the hardware SS pin
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
// or the SD library functions will not work.
pinMode(10, OUTPUT);
if (!SD.begin(4)) {
@ -47,9 +48,9 @@ void setup()
Serial.println("initialization done.");
root = SD.open("/");
printDirectory(root, 0);
Serial.println("done!");
}