Arduino code do not detect micro sd card

Hi, I have bougth two module to read/write micro SD card, and I use a simple code found in arduino pages, but it seems that SD card is not found.

Can someone help me?

Code:

#include <SPI.h>
#include <SD.h>

File myFile;

void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}

Serial.print(“Initializing SD card…”);

if (!SD.begin(4)) {
Serial.println(“initialization failed!”);
return;
}
Serial.println(“initialization done.”);

I allways got “initialization failed!” as result.

Connections done:

GND GND
5V 5V
CS 4 o 10
SCK 13
MOSO 12
MOSI 11

Thanks for your answers. :wink:

Are the cards formatted?

Paul

how about you go to arduino IDE,

File > example > SD > CardInfo , and upload that code?

remember to change the pin number according to ur connection

Hi
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

mbl:
GND GND
5V 5V
CS 4 o 10
SCK 13
MOSO 12
MOSI 11

What is 'CS 4 o 10' ?

Which pin do you physically have connected to the SD CS ?

Also, since you haven't mentioned what 'module' you are using- SD cards only work with 3.3V, if your modules don't have level shifting you'll be killing your SD cards.