Ok, Im back to work on a new project and I am working on setting speeds and measuring distance using wheel encoders. So I really need a functioning timer and am not clear on what the current state of the timers is and how to get them to work.
For example, if while my program is running, I want to read a sensor every 1/4 of a second how would I do that? I cant delay_ms(250) because that would freeze everything else for 250ms.
For example, timer0GetOverflowCount()*255+TCNT0; should increment by 1 every 61us, so there should be 16393 in a second.
So it seems like
should print "Tick!" once per second. But it prints it a lot more often than that! So I tried changing 16393 to 1,000,000 instead, then it didn't tick for a long time, then started ticking faster than I could see on the screen... so something is wrong.
So the timer is still my biggest enemy but I need to be better friends with it.
If someone could give me a couple snippets showing how to make something happen every x seconds and another piece of code showing how long between a set of events, I would really appreciate it!
Webbot, is that code you are working on in the beta build?