so i was using this code to send minimum reading on Blynk:
if (tempMin <= temp)
{
tempMin = tempMin;
Blynk.virtualWrite(V5, tempMin);
}
else if (tempMin > temp)
{
tempMin = temp;
Blynk.virtualWrite(V5, tempMin);
}
BUT now i added esp.sleep, it runs the code every time, so it thinks the temp is brand new every sleep cycle.
can i use EEPROM like i have hacked from @chrome1000 HVAC code:
#include <EEPROM.h>
float temp, tempMin, newTemp;
void runBME280()
{
bme.ReadData(temp); //reads BME280 temperature
>>etc
newTemp = temp;
if (tempMin <= newTemp)
{
tempMin = tempMin;
Blynk.virtualWrite(V5, tempMin);
}
else if (tempMin > newTemp)
{
tempMin = newTemp;
EEPROM.write(0, tempMin);
EEPROM.commit();
Serial.print("New minimum temperature saved to EEPROM: ");
Blynk.virtualWrite(V5, tempMin);
}
etc
void setup()
{
>>etc etc
EEPROM.begin(20); //Get saved temperature minimum from EEPROM
tempMin = EEPROM.read(0);
}
in the EEPROM.begin() how do i determine how many bytes i need for the tempMin float? the code i hacked is not really easy to work this out?
and is the address of (0) OK to use for this?
(it complies OK, but it is cold and dark and late at night and i don’t want to go out to get the hardware)