Go Down

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


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:


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


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:
It is unfortunate that there are 2 published libraries by the name Ticker.h

I look forward to your response


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


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


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.


hi i have problem with library ticker
i use arduino uno

#include <Ticker.h>  //Ticker Library

boolean ledOn = false;
volatile int buttonState = LOW;
volatile int invia = 0;
#define LED   13                      //Led
#define STATO 7                       //Stato Acceso/Spento
#define METRI 2                       //Metri emessi
#define TEMPO 1                       //Tempo
Ticker tic;

void setup()
  pinMode(STATO, INPUT);
  pinMode(LED, OUTPUT);
  attachInterrupt(digitalPinToInterrupt(METRI), interruptmetri, RISING);
  tic.attach(0.5, changeState);

//Invio dello stato del dispositivo
void changeState()
    if (digitalRead(STATO) == HIGH) {
      Serial.println ("1");
    } else {
      Serial.println ("2");

void interruptmetri()

void loop()
          //Ci sono metri da inviare
        if ( invia > 0 ) {
             Serial.println ("Metri Cambiare con il valore voluto");



Jan 02, 2019, 09:35 pm Last Edit: Jan 02, 2019, 09:37 pm by kowalski
@marioifix Did you forget
Code: [Select]
tic.update() in the
Code: [Select]

Go Up