Use the hardware PwmOut to pulsate an LED (or something else), with selectable active high/low, customisable intensity function, gamma correction, and number of brightness levels.
Diff: Pulsator.cpp
- Revision:
- 3:a789d816b3a2
- Parent:
- 2:e351afc2a3a8
- Child:
- 4:55b287904199
--- a/Pulsator.cpp Fri Apr 24 05:20:38 2015 +0000 +++ b/Pulsator.cpp Fri Apr 24 07:54:31 2015 +0000 @@ -61,7 +61,7 @@ out.period(1.0 / 1024.0); phase_2 = 0.0; step(); - ticker.attach(this, &Pulsator::step, 0.5 * period / levels); + ticker.attach(this, &Pulsator::step, 0.5 * period / (float)(levels - 1)); } void Pulsator::disable(void) @@ -85,7 +85,6 @@ disable(); } - /*! Enable or disable the output. * \param state Pulsate the output? * \note Passing \a false deactivates the output completely, rather than