Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Tinamore
#29590 Hi every one
To day, I need advice for a solution:
1. When Internet available, ESP8266 read Temperature from DHT12 and Send data to My server via Mqtt => OK
2. When Internet lost, ESP8266 Log data to file SDcard with line by line, Example:
Time............................value
2015-09-11 13:01:58 33
2015-09-11 13:01:59 34
2015-09-11 13:02:00 33
2015-09-11 13:02:01 33
.........bla bla
3. When Internet Come back, ESP8266 read file log line by line and send to server via mqtt, After successfully sent will delete the line just sent.
--------------------------------

With step 1: read DHT12 and send mqtt is very easy. I use example in SDK
Read DHT12 driver : https://github.com/CHERTS/esp8266-devkit/tree/master/Espressif/examples/dht22_thingspeak
Mqtt lib native code: https://github.com/CHERTS/esp8266-devkit/tree/master/Espressif/examples/esp_mqtt

I don't know solve steps 2 and 3 :|
I find google but not any library native code for ESP8266 read write and delete line by line log files to SD card.

Can anyone help me log data (read, write and delete line by line) to SDcard with native code using SDK (not use Arduino IDE).
thank you very much.