سلام عرض ادب ..دوستان میخوام اطلاعات انکودر در nodemcu ذخیره کنم بعد از چندساعت ارسال کنم به سرور.. نمونه کدی پیدا کردم که داده روی از انکودر میگیره میفرسته به سرور ولی میخوام قبلش ذخیره کنه و بعد از چندساعت یا یکروز بفرسته

کد:
#include <WiFiClient.h> #include <ESP8266WebServer.h>
#include <ESP8266HTTPClient.h>
const char *ssid = "ssid";  //ENTER YOUR WIFI ssid
const char *password = "password";  //ENTER YOUR WIFI password
#define S1 5
#define S2 4
int Number = 0;
int S1_LastValue = LOW;
int n;
String sensorData1, postData;
void setup() {
  
   pinMode (S1, INPUT);
  pinMode (S2, INPUT);
connectWifi();
}




void loop() {
   delay(100);
SendSensorData();


}




//function to connect to wifi
void connectWifi(){
  delay(1000);
  Serial.begin(115200);
  WiFi.mode(WIFI_OFF);        //Prevents reconnection issue (taking too long to connect)
  delay(1000);
  WiFi.mode(WIFI_STA);        //This line hides the viewing of ESP as wifi hotspot
  WiFi.begin(ssid, password);     //Connect to your WiFi router
  Serial.println("");
  Serial.print("Connecting");
  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  //If connection successful show IP address in serial monitor 
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());  //IP address assigned to your ESP
}




//function to send sensor data 
void SendSensorData() {
  
  HTTPClient http;    //Declare object of class HTTPClient


n = digitalRead(S1);
  if ((S1_LastValue == LOW) && (n == HIGH))
  {
    if (digitalRead(S2) == LOW) Number--;
    else                        Number++;
    Serial.println(Number);
    sensorData1=Number;
 
 
  
 // String sensorData2,sensorData3,sensorData4,sensorData5,sensorData6,sensorData7;
  //sensorData1=Number;
   // sensorData2=Number;
     // sensorData3="High";
       // sensorData4="High";
          //sensorData5="High";
           // sensorData6="High";
             // sensorData7="High";
  //Post Data
 // postData = "sensor1=" +  sensorData1 + "&sensor2=" + sensorData2+ "&sensor3=" + sensorData3+  "&sensor4=" + sensorData4+ "&sensor5=" + sensorData5+ "&sensor6=" + sensorData6+  "&sensor7=" + sensorData7;
 postData = "sensor1=" +  sensorData1;
  http.begin("http://#/esp866/postData.php");
   http.addHeader("Content-Type", "application/x-www-form-urlencoded");
  
  int httpCode = http.POST(postData);   //Send the request
  String payload = http.getString();
  Serial.println(httpCode);   //Print HTTP return code
  Serial.println(payload);    //Print request response payload
  http.end();  //Close connection
  }
 
  S1_LastValue = n;


 
 
  
  


  
}