Arduino Mega2560 Interrupt library and examples

Hi,
I use Mega2650 board, and i need to start a timer to call a function at 1000ms sharp.
Cannot "" timers/interrupt library in my project. Maybe i have to add the library first?
Please help,
THANKS!

I use Mega2650 board, and i need to start a timer to call a function at 1000ms sharp.

Would using millis() for timing be accurate enough ?

felix_fetche:
Cannot "" timers/interrupt library in my project. Maybe i have to add the library first?

That's not very clear. You'd need to provide more details about this library.

But I agree with UKHeliBob that you should consider how this can be done without use of interrupts. They have their uses but can also add unnecessary complexity.

I need to setup a timer that will call a function that will execute integration, need to use like measuring battery capacity, function will integrate measured value*dt
The function to be called automaticaly, not by main();
For this please let me know if i need to add timer library, give me an example please.
Thanks sofar!

felix_fetche:
I medd to setup a timer that will call a function that will execute integration, need to use like measuring battery capacity, function will integrate measured value*dt

Why not simply use millis() or micros() to manage the timing as illustrated in Several things at a time.

And have a look at Using millis() for timing. A beginners guide if you need more explanation.

...R

have someone here used Thread.h with Mega 2560 ?
could be a solution to create with this the automatic repetitive calling to a function..
need timer library for using Tread.h ?

Solved very easy,
found and add TimerOne and TimerThree libs, works charming!

felix_fetche:
Solved very easy,
found and add TimerOne and TimerThree libs, works charming!

I would be interested to see the code as it is now