hi i want to send integer( 4x4 array) from sd card to arduino....
so i use CSV File. i saw any other similar topics and i followed that but it wasn't working,,
for instance,
124,54,250,111
231,21,12,188
144,56,160,116
211,21,15,118 like this..
first of all, i made CSV File at the sd card.
and uploaded code like this, but it wasn't working. i don't know what the problem is...
i appreciate if you help my problem..
#include <SD.h>
#include<SPI.h>
File myFile;
char disp[4][4];
Sd2Card card;
SdVolume volume;
SdFile root;
const int chipSelect = 4;
void setup() {
Serial.begin(9600);
Serial.print("\nInitializing SD card...");
pinMode(10, OUTPUT);
if (!card.init(SPI_HALF_SPEED, chipSelect)) {
Serial.println("initialization failed. Things to check:");
Serial.println("* is a card is inserted?");
Serial.println("* Is your wiring correct?");
Serial.println("* did you change the chipSelect pin to match your shield or module?");
return;
} else {
Serial.println("Wiring is correct and a card is present.");
}
Serial.print("\nCard type: ");
switch (card.type()) {
case SD_CARD_TYPE_SD1:
Serial.println("SD1");
break;
case SD_CARD_TYPE_SD2:
Serial.println("SD2");
break;
case SD_CARD_TYPE_SDHC:
Serial.println("SDHC");
break;
default:
Serial.println("Unknown");
}
if (!volume.init(card)) {
Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
return;
}
uint32_t volumesize;
Serial.print("\nVolume type is FAT");
Serial.println(volume.fatType(), DEC);
Serial.println();
volumesize = volume.blocksPerCluster();
volumesize *= volume.clusterCount();
volumesize *= 512;
Serial.print("Volume size (bytes): ");
Serial.println(volumesize);
Serial.print("Volume size (Kbytes): ");
volumesize /= 1024;
Serial.println(volumesize);
Serial.print("Volume size (Mbytes): ");
volumesize /= 1024;
Serial.println(volumesize);
Serial.println("\nFiles found on the card (name, date and size in bytes): ");
root.openRoot(volume);
root.ls(LS_R | LS_DATE | LS_SIZE);
}
void loop(void) {
myFile = SD.open("DATA.CSV",FILE_READ);
while(myFile.available()){
for(int a=0; a<4;a++){
for(int b=0; b<4;b++){
disp[a][b] = myFile.read();
Serial.print(disp[a][b]);
delay(100);
}
}
}
myFile.close();
}