Timer Interrupt longer than 8 secs?

I wish an interrupt to take readings every 10 seconds and make a calculation, and I am limited by Timer1.

So far I am using a timer initialisation of 1 second and incrementing int x to only running the code to read and calculate every 10 times.

Is there a better way?

Could I use a RTC to do this?

Yes... http://forum.arduino.cc/index.php?topic=223286.0

Apologies, but I can’t seem to find the part about using timer interrupts?

Taking sensor readings every 10 seconds will never be an appropriate use of interrupts. Save yourself a great deal of headache. Use the correct tool. In this case, blink-without-delay is the correct tool.

The demo several things at a time is an extended example of the BWoD technique.


Thanks, I see what you mean now. Unfortunately due to some convoluted code I am using; through phi prompt; I have my main code before running inside a while loop in the menu system. The whole loop was taking approx 4 secs to run and originally I wanted samples every 1 seconds.

This is why I took it outside to a timer interrupt. This worked but I then discovered that 1 sec was far too frequent as I was running a PID calculation and the Integral Term was becoming enormous in the slow response of the temperature system it was controlling.

I considered moving back to code when I moved back to 10 second readings using mills() again but my concern was that if the loop is 4 seconds then the comparison would be true after 3 loops the first time then 2 on the second time through causing inconsistency?

if the loop is 4 seconds then the comparison would ....

Time to start over and write a program that loops 100 times per second (or much faster).



Time to stop being idle and learn to use switch cases and LCD menu systems rather than relying on albeit good, but probably inappropriate libraries.