#define READ_DELAY 1000
unsigned long lastUpdate; //tracks clock time of last temp update
//call repeatedly in loop, only updates after a certain time interval
//returns true if update happened
bool my_update() {
if ((millis() - lastUpdate) > READ_DELAY) {
lastUpdate = millis();
return true;
}
return false;
}
void setup() {
Serial.begin(9600);
// put your setup code here, to run once:
while (!my_update()) {} //wait until updated
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print(my_update());
}