New Ticker (Timer) Library

When can you (and can't you) start a Ticker?

I'm trying to understand exactly when things happen, depending on when you start a Ticker, and when you update. I have modified the sample code, and it isn't behaving as I expected.

Here's my updated code. The key thing I'm experimenting with here is that I don't start all the timers at once, although I do do a timerX.update for all timers at the top of the void loop{}. I start timer1 in the setup, but then get each timer's callback procedure to start the next timer. Is this a valid thing to do?

#include <Ticker.h>

void printMessage();
void printCounter();
void printCountdown();
void blink();
void printCountUS();

bool ledState;
int counterUS;

Ticker timer1(printMessage, 0, 1); // once, immediately
Ticker timer2(printCounter, 1000, MILLIS); // internal resolution is milli seconds
Ticker timer3(printCountdown, 1000, 5); // 5 times, every second
Ticker timer4(blink, 500); // changing led every 500ms
Ticker timer5(printCountUS, 100, 0, MICROS_MICROS); // the interval time is 100us and the internal resolution is micro seconds

void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(9600);
delay(2000);
timer1.start();
}

void loop() {
timer1.update();
timer2.update();
timer3.update();
timer4.update();
timer5.update();
if (timer4.counter() == 20) {
timer4.interval(200);
Serial.println("Slowing to 200");
}
if (timer4.counter() == 80) {
timer4.interval(1000);
Serial.println("Slowing to 1000");
}
}

void printCounter() {
Serial.print("Timer 2: Counter ");
Serial.println(timer2.counter());
timer3.start();
}

void printCountdown() {
Serial.print("Timer 3: Countdown: 5 times a second ");
Serial.println(5 - timer3.counter());
timer4.start();
}

void printMessage() {
Serial.println("Timer 1: printMessage: Hello!");
timer2.start();
}

void blink() {
digitalWrite(LED_BUILTIN, ledState);
ledState = !ledState;
Serial.print("Timer 4: blink ");
Serial.print(String(ledState));
Serial.print(", Counter=");
Serial.println(String(timer4.counter()));
timer5.start();
}

void printCountUS() {
counterUS++;
if (counterUS == 10000) {
Serial.println("Timer 5: Count Us: 10000 * 100us");
counterUS = 0;
}
}

... and here's the serial monitor:

First observation: Timer 4 (blink) seems to run a number of times without its counter incrementing. I think everything else is behaving properly, but I'd appreciate reassurance on this! I'm trying to write a piece of code that is driving me demented, and I think Ticker might save my life if only I can understand it correctly.

Timer 1: printMessage: Hello!
Timer 2: Counter 1
Timer 3: Countdown: 5 times a second 4
Timer 4: blink 1, Counter=1
Timer 3: Countdown: 5 times a second 3
Timer 4: blink 0, Counter=1
Timer 5: Count Us: 10000 * 100us
Timer 3: Countdown: 5 times a second 2
Timer 4: blink 1, Counter=1
Timer 5: Count Us: 10000 * 100us
Timer 3: Countdown: 5 times a second 1
Timer 4: blink 0, Counter=1
Timer 3: Countdown: 5 times a second 0
Timer 5: Count Us: 10000 * 100us
Timer 4: blink 1, Counter=1
Timer 4: blink 0, Counter=2
Timer 5: Count Us: 10000 * 100us
Timer 4: blink 1, Counter=3
Timer 4: blink 0, Counter=4
Timer 4: blink 1, Counter=5
Timer 5: Count Us: 10000 * 100us
Timer 4: blink 0, Counter=6
Timer 4: blink 1, Counter=7
Timer 5: Count Us: 10000 * 100us
Timer 4: blink 0, Counter=8
Timer 4: blink 1, Counter=9
Timer 4: blink 0, Counter=10
Timer 5: Count Us: 10000 * 100us
Timer 4: blink 1, Counter=11
Timer 4: blink 0, Counter=12
Timer 5: Count Us: 10000 * 100us
Timer 4: blink 1, Counter=13
Timer 4: blink 0, Counter=14
Timer 4: blink 1, Counter=15
Timer 5: Count Us: 10000 * 100us
Timer 4: blink 0, Counter=16
Timer 4: blink 1, Counter=17
Timer 5: Count Us: 10000 * 100us
Timer 4: blink 0, Counter=18
Timer 4: blink 1, Counter=19
Timer 5: Count Us: 10000 * 100us
Timer 4: blink 0, Counter=20
Slowing to 200
Slowing to 200
Slowing to 200
Slowing to 200
Slowing to 200