Kód: Vybrat vše
if (currentMillis - prevTemp > DS_delay && tmpRequested) { // 750 ms after requesting the temperature
uint32_t actualTime = timeUNIX + (currentMillis - lastNTPResponse) / 1000;
// The actual time is the last NTP time plus the time that has elapsed since the last NTP response
tmpRequested = false;
float temp = random(0,80); // Get the temperature from the sensor
temp = round(temp * 100.0) / 100.0; // round temperature to 2 digits
float temp1 = random(0,20); // Get the temperature from the sensor
temp1 = round(temp1 * 100.0) / 100.0; // round temperature to 2 digits
Serial.printf("Appending temperature to file: %lu,", actualTime);
Serial.print(temp);
Serial.print(',');
Serial.println(temp1);
File tempLog = SPIFFS.open("/temp.csv", "a"); // Write the time and the temperature to the csv file
tempLog.print(actualTime);
tempLog.print(',');
tempLog.print(temp);
tempLog.print(',');
tempLog.println(temp1);
tempLog.close();
Serial.println("Data zapisane do suboru");
}
1649762425,24.00,0.00
1649762485,52.00,14.00
1649762545,21.00,16.00
1649762605,29.00,9.00
1649762665,42.00,16.00
1649762725,31.00,7.0˙˙˙1649762785,63.00,2.00
1649762845,50.00,11.00
1649762905,11.00,9.0˙˙˙1649762965,18.00,9.00
1649763025,35.00,4.00
1649763085,7.00,2.00˙˙1649763145,13.00,9.00
1649763205,13.00,9.00
1649763265,25.00,11.00
1649763325,73.00,0.0˙˙˙1649763385,64.00,9.0˙˙˙1649763445,49.00,16.00
1649763505,70.00,12.00
1649763565,41.00,9.0˙˙˙1649763625,13.00,0.00
1649763685,18.00,3.00
1649763745,2.00,14.0˙˙˙1649763805,30.00,5.0˙˙˙1649763865,24.00,0.00
1649763925,49.00,7.00
1649763985,48.00,15.00