ovidiucp / TinyWebServer

Small web server for Arduino, fits in 10KB ROM, less than 512 bytes RAM
http://www.webweavertech.com/ovidiu/weblog/archives/000484.html
GNU Lesser General Public License v2.1
245 stars 65 forks source link

TinyWebServer + Data Logger #29

Closed kadu closed 8 years ago

kadu commented 8 years ago

Hi, I'm trying to use TinyWebServer to control my board but I also need to log my board events on SD Card, my last function

void loga() {
  String dataString = "/*/*/*/***//**/*/*/";
  File dataFile = SD.open("datalog2.txt", FILE_WRITE);
  if (dataFile) {
    dataFile.println(dataString);
    dataFile.close();
    Serial.println(dataString);
  }
  else {
    Serial.println("error opening datalog2.txt");
  }
}

datalog2.txt does not exists in sdcard, SD.open is not able to create the file. If I run Datalogger example all things run perfectly.

There are some especial way to write files using TinyWebServer ?

ovidiucp commented 8 years ago

Have you properly initialized the SD library, as it is done in the setup() function of the Datalogger example?

Also, where are you calling loga() from? Can you make sure it's called at least once?

There is nothing specific in TWS about the SD library. In fact it is used in few examples. Take a look at the FileUpload example to see how it writes into a file.

kadu commented 8 years ago

My error is on i2c, thanks for help