Timer interrupts

Hi everyone,

I'm just getting started with my Arduino Uno and was curious as to how to use a timer interrupt. Simply put, I want my program to wait for use to type a number into the serial port, and after a certain time, I want to turn on an LED.

I understand how to set up the timer and interrupt, but I wasn't sure how to make sure the timer starts at zero when the user signals to start. (My ISR currently just signals a flag once the timer is tripped, but I don't know if the timer starts counting at zero or if it just continues from whatever timing it's currently at.)

I apologize if this is a really simple question -- it's my first time doing this kind of thing!

Thanks!

The very best source of information is the Atmel datasheet for the Atmega328. If you want to do anything that is not directly available as an Arduino function it is an essential reference.

It sounds like you just want to learn how to use the Timer - which is great.

However if you really just want something to happen after a suitable wait interval it is very unlikely to be necessary to use a Timer. Have a look at how millis() is used to manage timing in several things at a time

...R