When it hits 150 a timer needs to start so it stays at 150 for an hour. After an hour it needs to go up to a different temperature (220). And then stay at that for an hour.
You need to save the value of millis() when the temperature reaches 150 and then keep checking the time until the 60 minutes (3,600,000 msecs) has elapsed
if (millis() - savedMillis >= 3600000UL) {
// time to change the temperature.
}
If you are only interested in longer time intervals you could create a variable (called seconds ?) which is upldated from millis() but makes the timing calcs more obvious. For example
seconds = millis() / 1000;
if (seconds - savedSeconds >= 3600) {
// time to change the temperature
}
Use unsigned long variables for everything connected with millis()
Robin2:
You need to save the value of millis() when the temperature reaches 150 and then keep checking the time until the 60 minutes (3,600,000 msecs) has elapsed
if (millis() - savedMillis >= 3600000UL) {
// time to change the temperature.
}
The demo [Several Things at a Time](http://forum.arduino.cc/index.php?topic=223286.0) illustrates the use of millis() for timing.
If you are only interested in longer time intervals you could create a variable (called seconds ?) which is upldated from millis() but makes the timing calcs more obvious. For example
seconds = millis() / 1000;
if (seconds - savedSeconds >= 3600) {
// time to change the temperature
}
Use unsigned long variables for everything connected with millis()
...R
Thanks, I'll be trying this tonight and let you know what I did.