MTclockDouble: Example 4
Event management for Uno, Nano, Mega
Bursts of 5 flashes
We want to make a flashing LED, but we replacethe fix light by 5 flashes. The chronogram is:

We will use a first clock which will deliver 5 flashes and which will be regularly started by a second clock.
Complete program recommended
This program is completely under interruption, and releases loop which can be used to do something else.
// This program is flashing 5 times an LED #include <MTobjects.h> // V1.0.6 See http://arduino.dansetrad.fr/en/MTobjects // Implementation of 5 fast flashes void lights(void) { digitalWrite(LED_BUILTIN, HIGH); } void extinct(void) { digitalWrite(LED_BUILTIN, LOW); } MTdoubleClock FiveFlashes(100 milli_seconds, 50 milli_seconds, lights, extinct, 10 actions_and_stop, MT_OFF); // Regular launch of 5 flashes void flashes(void) { FiveFlashes.start(); } MTclock Metronome(2000 milli_seconds, flashes); void setup() { pinMode(LED_BUILTIN, OUTPUT); } void loop(){}