Refresh time...Can anyone help me please??

At first...thank you to everyone for your fast answers:

Pylon:

pylon:
First of all: You didn't post the contents of the COMMANDS.txt.

What is the refresh rate? 1000?

In my txt file of commans.txt only you can see in the first line: 15000
With this I answered your questions.

I changed:

int refresh_rate = 0.0; //Dataloger Refresh Rate

and:

if (currentTime >= lastReadTime + refresh_rate) {
lastReadTime = millis();
File logFile = SD.open("LOG.csv", FILE_WRITE);
logFile.println(sensors.getTempCByIndex(0));
logFile.close();
Serial.println(sensors.getTempCByIndex(0));

}

As a result I got a delay about a half as before (before 1 second in a minute), with this 1 second in 2 minutes. It is important the precission for this project because it will take measurements for 10 days or more...

PeterH

You have the best solution for my problem now...I tried this code:

void loop()
{
sensors.requestTemperatures(); // Obtener temperaturas DS18B20

if (millis()- lastReadTime > refresh_rate)
{
lastReadTime += refresh_rate;
File logFile = SD.open("LOG.csv", FILE_WRITE);
logFile.println(sensors.getTempCByIndex(0));
logFile.close();
Serial.println(sensors.getTempCByIndex(0));
}
}

And I got a delay of a second each 5 minutes. But as I said before I need more precission.

Thank you to everyone! :slight_smile: