ITDB32WD and SdFat.h


hi!

please, using sd card on tft library sdfat.h?

i need write .txt.

i think haven't problem in code because works itdb32s.

anyway here's code:

code: [select]

#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 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 image using tinyfat.h:



thanks in advance.

fernando garcia

code: [select]
      file.print(temp);
      file.write((uint8_t*)"\0", 1);
      file.write((uint8_t*)"\r\n", 2);

trying write null pointless. code should simply:
code: [select]
      file.println(temp);

code: [select]
anyway here's code:
which something. supposed guess does, problem is?


Arduino Forum > Using Arduino > Programming Questions > ITDB32WD and SdFat.h


arduino

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support