Hi!
Please, someone are using the SD card on TFT with the library SdFat.h?
I need only write a .TXT.
I think that haven't problem in my code because it works with the ITDB32S.
Anyway here's my code:
#include <SdFat.h>
const int chipSelect = 5;
Sd2Card card;
SdFile file;
SdFile root;
SdVolume volume;
float temp;
float tempe;
void setup()
{
int16_t n;
char buf[8];
Serial.begin(9600);
pinMode(53,OUTPUT);
pinMode(69,OUTPUT);
digitalWrite(53,HIGH);
digitalWrite(69,HIGH);
card.init(SPI_FULL_SPEED,chipSelect);
volume.init(&card);
root.openRoot(&volume);
while(!Serial)
{
; // wait for serial.
}
if(file.open(&root, "LOGTDIA.TXT", O_CREAT | O_APPEND | O_WRITE))
{
Serial.println("Writing...");
Serial.println();
for(temp=27.5; temp>22.0; temp-=0.15)
{
file.print(temp);
file.write((uint8_t*)"\0", 1);
file.write((uint8_t*)"\r\n", 2);
}
for(tempe=22.5; tempe<28.0; tempe+=0.15)
{
file.print(tempe);
file.write((uint8_t*)"\0", 1);
file.write((uint8_t*)"\r\n", 2);
}
file.close();
Serial.println("Done!");
Serial.println();
}
else
{
Serial.println("Can't open.");
}
if(file.open(&root, "LOGTDIA.TXT", O_READ))
{
Serial.println("Reading...");
Serial.println();
delay(5000);
while ((n = file.read(buf, sizeof(buf))) > 0)
{
Serial.println(buf);
}
file.close();
Serial.println();
Serial.print("Finished!");
}
}
void loop()
{
}
The ITDB32WD works fine using tinyFAT.h.
Here an image using tinyFAT.h:
Thanks in advance.
Fernando Garcia