New Ticker (Timer) Library

Status
Not open for further replies.
But you are aware of the intervalTimer object in the Teensy core which does the same with microsecond precision and using interrupts so that the callback function is called automatically without checking in the loop() and not troubled by delay() ?
 
I know about the TimerOne and TimerThree libraries. But this another way which avoid interrupts, volatile datatypes etc. and you are not limited in the numbers of timers.
 
Sorry to bring this conversation back up - but how does this Ticker library compare to the built in elapsedMillis or elapsedMicros?

How do both of them fair when dealing with Teensy Threads?

I am currently using elapsedMillis and have something happening every 10 seconds, but in reality it seems to happen at a different rate, and Im just trying to narrow it down.
 
Sorry to bring this conversation back up - but how does this Ticker library compare to the built in elapsedMillis or elapsedMicros?

It's basically the same. It's redundant.

How do both of them fair when dealing with Teensy Threads?

You'd have to test the interaction with the threads scheduler in your specific code, perhaps adjusting interrupt priorities. Teensy threads is an external library, AFAIK, there is no direct support by PJRC.

I am currently using elapsedMillis and have something happening every 10 seconds, but in reality it seems to happen at a different rate, and Im just trying to narrow it down.

I'd still reiterate my suggestion to use the native IntervalTimer object instead, with a high interrupt priority, so that it overrides the threads scheduler timing. Seems the cleanest solution to me.
 
Thanks - I just solved the problem I had, me and my typical stupid mistakes.
Something was taking longer than I expected it would (RS485 comms) and so the repeating function wasn't even finished running the first time when it 'should' have started running the 2nd time.

elapsedMillis() is working fine for what I need, but thanks for the info on the IntervalTimer, I will look into that.
 
Status
Not open for further replies.
Back
Top