hi i'm omar
so i'm making a project with a micro sd card and a speaker,i tried testing if the sd card module is working or not by testing the "cardinfo" example from the SD library,it sayed it's properly connected and all the information of the card was displayed properly.but when i tried the "files" example it said it is "failed to initialize sd card ".i'm using the kingston 32gb micro sd card.i'm dealing with the aruino uno board, i connected the MOSI TO 11,MISO TO 12,SCK TO 13 and CS TO 10.i inserted the sd card until it made a click noise so that means it is inserted well.i checked the wiring. this is the link for the micro sd card module i'm using:Micro SD Card Module For Arduino or MCU - Lampatronics. this is the code
#include <SD.h>
#include <TMRpcm.h>
#include <SPI.h>
TMRpcm pcm;
#define speaker 9
#define sdcard 10
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
SPI.begin();
if(!SD.begin(sdcard)){
Serial.println("memory is still the same");
return;
}
{
Serial.println("memory increased");
}
pcm.speakerPin = speaker;
}
void loop() {
// put your main code here, to run repeatedly:
pcm.play("my file");
delay(2000);
}
this an image for the connections. the wiring is a little bit tangled but i just couldn't untangle it for some reason:
i did, i also tried the 10 ,8,and 4 for the cs pin and i tried to switch between the mosi and miso but still not working, thanks for all these people for replying
How are you powering the SD module? Can you put a voltmeter on that VDD pin and see if there's any drop in voltage from 5V when you run the Files example? What happens when you press the reset button on the Uno after Files has failed?
it should work if you power the SD Card module via 5V pin of Arduino.
Please run the example code in this Arduino Micro SD Card tutorial, thencheck where the code can reach by checking the log on Serial Monitor.
i tried the code in the website it said this errorCompilation error: redefinition of 'SDLib::File myFile'
i don't know what it means or what should i do?