I'm having difficulty understanding how to use the Time library. In particular... I have a variable "previous_read_millis" which records the last time I read the sensors. I then want to do some further logic based on the hour and minutes of the time recorded as per the following line of code...
if(hour(previous_read_millis) = 8)
This didn't produce the desired result, so I tried outputting a test sketch to the serial monitor to see what was happening...
Serial.println (previousMillis); Serial.print ("hour "); Serial.println (hour(previousMillis)); Serial.print ("minute "); Serial.println (minute(previousMillis)); Serial.print ("second "); Serial.println (second(previousMillis));
This code returned the following output
9181 hour 2 minute 33 second 1 10200 hour 2 minute 50 second 0
but surely this is wrong... I was expecting...
hour 0 minute 0 second 10
What am I doing wrong...?