Go Down

Topic: New Ticker (Timer) Library (Read 2383 times) previous topic - next topic

sstaub

I made a new Ticker library based on the ArduinoTimerObject library, which uses the millis() function to call a function repeatedly. You can find it on github:
https://github.com/sstaub/Ticker

sstaub

I made a new version v2 with some new features:
- internal resolution now micros()
- you can determine the number of repeats of the callback function
https://github.com/sstaub/Ticker

rbright

Stefan your library works great on a UNO etc and I've seen your V3 BUT have you considered an adaption to it would work with ESPs ???
Please refer to my other topic as follows:
https://forum.arduino.cc/index.php?topic=537511.0.
It is unfortunate that there are 2 published libraries by the name Ticker.h

I look forward to your response

sstaub

Have you tried my library for ESP? I think it should work for every platform which use the Arduino framework.

rbright

Thanks for the continual refinement of your library. Hopefully in time it will allow code to be universal for any board like UNO or ESPs.

Following is some feedback on what I have discovered on 2 different windows 10 PCs. Today I even upgraded the IDE on both PCs from 1.8.3 to the latest 1.8.5 to see if that would make a difference.

Now when I run your example using your version 3.1 it compiles and runs fine on a UNO BUT when I try it on a ESP01, which has a different processor internally, I get the following compile errors:

In the IDE I selected Tools/Board: Generic ESP8266 Module and using Example.ino

Line 12 error: no matching function for call to 'Ticker::Ticker(void (&) () , int, int)'
Ticker timer1(printmessage, 0, 1);
                                              ^

is this a problem in one of your 'h' or 'cpp' files


I noticed during the clean installation of IDE 1.8.5 that after I go into Preferences and set 'Additional Boards ...' to find esp8266.com that the competing Library Ticker for ESP loads and its example files are now available under Files/Examples/Examples for Generic ESP8266  

Look forward to your comments
   

sstaub

Have you tried
Code: [Select]
Ticker timer1(printMessage, 0, 1);. I think there is typo in your code (upper case M in printMessage. The code should work on every board which use the Arduino framework.

Go Up