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.

Dependents:   RedButton

Revision:
4:55b287904199
Parent:
3:a789d816b3a2
Child:
5:26cc18306d95
--- a/Pulsator.cpp	Fri Apr 24 07:54:31 2015 +0000
+++ b/Pulsator.cpp	Fri Apr 24 07:58:22 2015 +0000
@@ -53,7 +53,7 @@
     out = active_high ? level : 1.0 - level;
     phase_2 += M_PI_2 / (float)(levels - 1);
     if(phase_2 >= M_PI)
-        phase_2 = 0.0;
+        phase_2 -= M_PI;
 }
 
 void Pulsator::enable(void)