http://www.ladyada.net/learn/arduino/ethfiles.html
The latest Arduino Ethernet shield comes with a handy MicroSD card slot so that you can store and retrieve data through the shield. Very handy! Lets show how to talk to the card.
Be sure to have the very latest version of SdFatLib , as you'll need some of the newer capabilities!
First thing to note is that the SS (Slave Select) pin for the card is digital 4 (although as of the writing of this mini-tutorial, the schematic hasn't been updated, you'll have to trust me!)
Open up the SdFatInfo example sketch and change the line in loop() from
uint8_t r = card.init(SPI_HALF_SPEED);
To:
pinMode(10, OUTPUT); // set the SS pin as an output (necessary!)
digitalWrite(10, HIGH); // but turn off the W5100 chip!
uint8_t r = card.init(SPI_HALF_SPEED, 4); // Use digital 4 as the SD SS lineBe sure to add those two extra lines right before-hand! They Enable the SPI interface. If you're on a Mega, use pin 53 instead of 10
Now upload and test the card, you should see something like this:
I have a couple of questions about the way this works..
-
Can't the default library that comes with Arduino 1.0 be modified in the same way?.
pinMode(10, OUTPUT); // set the SS pin as an output (necessary!)
digitalWrite(10, HIGH); // but turn off the W5100 chip!
A. Should pin 10, not be automatically set as an output anyway? what was it "prior"
B. 10,LOW turns off the wiznet chip at any point? in the code, would this make 10,11,12 (eg, the pins it uses, now safe to use?)