MTsoftPWM: Example 1
Event management for Uno, Nano, Mega
Flashing of an LED
This program will flash LED_BUILTIN
We will use the PWM soft to be a succession of 5 flashes and stop. A metronome will regularly relaunch the PWM. It is the PWM which will therefore make the flashes and the metronome that will generally give the blinking
Complete program recommended
This program is completely under interruption, and releases loop which can be used to do something else.
// This program will flash LED_BUILTIN #include <MTobjects.h> // V1.0.6 See http://arduino.dansetrad.fr/en/MTobjects // 5 quick flashs MTsoftPWM FiveFlash(LED_BUILTIN, inpulses_width 50000 micro_seconds, periods_width 100000 micro_seconds, start_with HIGH, 10 levels_and_stop); // Launch of flashes every 2 seconds void flash(void) { FiveFlash.start(); // Relaunch PWM } MTclock Metronome(2000 milli_seconds, flash); void setup(){} void loop(){}