Hi all just need a little help maybe missing something, I managed to get a program to write and log to an SD card using an Ardunio UNO, I've decided to switch to an Ardunio MEGA as it was low on storage capacity and could become unstable, I now have a problem that the SD Card doesn't work when connecting up to the changed pins on the MEGA, but as a check switched back to the UNO everything is fine am I missing something. I've changed settings in the menus and port etc it compiles ok.
do I need to define the MEGAS at the top of the program ??????
Read the how to use this forum-please read sticky to see how to properly post code and some advice on how to ask an effective question. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.
Do you know that the SPI pins are different on a Mega from the Uno?
the UNO memory was low not the SD Card, I'm using an SD Card Shield,
connection to the card are
UNO MEGA
SS 10 53
MOSI 11 51
MISO 12 52
SCK 13 50
I have used this bit of code....
Serial.print("Initializing SD card...");
if (!SD.begin(53)) { /*check to see if serial comms available to SD card*/
Serial.println("initialization failed!"); /*print this if the card fails to intialise*/
while (1); /*keep doing this until the card issue is resolved*/
}
Serial.println("initialization done."); /*print this if card has successfully intialised*/
if (SD.exists(foldername)) { /*this line to check if the folder exists*/
Serial.println("Folder exists.");
}
else {
Serial.println("Folder doesn't exist."); /*acknowledge that teh folder doesn't exist*/
}
it seems that if the shield is left plugged into the UNO board and only 5V and 0V connected the shield behaves itself and the program runs with the MEGA and recognises the SD card. The SD Card I'm using is
Apologise if I've offended anyone but I'm very new to this.