So I have an Arduino Uno, and I purchased the Adafruit MicroSD card breakout board and a 2GB Micro SD card from Adafruit as well.
I have all of the pins correctly inserted as detailed by the Adafruit website, and I put the MicroSD card in the Breakout Board, and everything should be working, but I keep getting Initialization Failure when I try to run the CardInfo program under File - Examples - SD - CardInfo. I changed the chipSelect from 4 to 10 because I'm using Pin 10 for CS (again, as Adafruit's website said I should do).
This is the tutorial that I have followed to make my first SD Card Related Program to work.
//SIMPLE WRITE AND READ
#include<SPI.h> //sd cARD USES spi bUS
#include<SD.h> //contains library functions
#define CSPIN 10 //slecting DPin-10 requires to set direction as output
File myFile; //file pointer variavle declaration
void setup()
{
Serial.begin(9600);
SD.begin(CSPIN); //SD Card is initialized
SD.remove("Test1.txt"); //remove any existing file with this name
myFile = SD.open("Test1.txt", FILE_WRITE); //file created and opened for writing
if(myFile) //file has really been opened
{
myFile.println("Arduino!"); //Arduino is written into SD Card
}
myFile = SD.open("Test1.txt", FILE_READ); //file created and opened for writing
if(myFile) //file has really been opened
{
while(myFile.available())
{
Serial.print((char)myFile.read()); //Arduino read back from SD Card and is shown on Monitor
}
myFile.close();
}
}
void loop()
{
}