Chat freely about anything...

User avatar
By torntrousers
#37644 The only memory retained over deepSleep is the RTC memory which you access with the functions system_rtc_mem_read and system_rtc_mem_write. Read more about them in the SDK Guide. There's some example code in a bug report about it not working properly at the moment with a work around being to start at location 65 instead of 64.
User avatar
By GengusKahn
#37645 Hi there, there are at least 2 options, the first of these would be the SPIFFS, the other would be online storage if this is available prior to you needing to use the variable....

Code: Select allFile logF = SPIFFS.open("/humidlog.CSV", "a");
  if (logF) {
    logF.print(logdata);
    logF.close();
    ulMeasCount++;   
      }
    else {
      while(1);
    }
// Use WiFiClient class to create Thingspeak Post
  WiFiClient client;
  if (!client.connect(hostts, 80)) {
    return;
  }
  String url = "/update?key=";
  url += thingspeak_key;
  url += "&field1=";
  url += pfTemp;
  url += "&field2=";
  url += pfHum;
  url += "&field3=";
  url += pfDew;
  url += "&field4=";
  url += pfVcC/1000, 3;
// This will send the request to the server
  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + hostts + "\r\n" +
               "Connection: close\r\n\r\n");
  delay(50);
  client.stop();   
}



to read back the value from Thingspeak....
http://api.thingspeak.com/channels/73184/field/1/last.txt

Code: Select all
  // Make a HTTP GET request to the Thingspeak
  // if you get a connection, report back via serial:
if (client.connect("184.106.153.149", 80)) {//Thingspeak IP
    Serial.println("connected to server");
    // Make a HTTP request:
    client.println("GET http://api.thingspeak.com/channels/73184/field/1/last.txt");
    client.println("Connection: close");
    client.println();
  } 


  while(!!!client.available()) {
     yield();
  } 
  String theData = client.readString();
      Serial.println(theData);

          client.flush();
          client.stop();