I got my Arduino Mega 2560 R3 half a year ago, so I'm not an expert or anything like that. I've recently started a project where it is necessary for me to time something with high accuracy. What I'm timing will last for somewhere between five and ten seconds, closer to five. I need accuracy down to approximately +/- 10 milliseconds. What would be the best way to get this? A loop with a variable that increases with +1, then delay(1)? (I've heard that one should try to avoid the delay-function) An interrupt of some sort? Should this be done only by software, or are there some hardware, in addition to the arduino, required?
(sorry for not being more spesific about the project, it's still to early)