The library can flash an LED or DigitalOut pin at 50% duty using a Ticker interrupt triggered toggle function. This library does NOT use wait() so that it can flash a pin while more code is being executed. Instead, it relies on Ticker generated interrupts. There is only one parameter required, the on/off time of the pin in seconds (i.e. 0.5 means 0.5 seconds on and 0.5 seconds off).

Revision:
1:0764e2d49518
Parent:
0:32fa44559a40
Child:
2:fddd1a6486bd
diff -r 32fa44559a40 -r 0764e2d49518 ToggleFlash.h
--- a/ToggleFlash.h	Sat Dec 22 21:07:34 2012 +0000
+++ b/ToggleFlash.h	Sat Dec 22 21:14:51 2012 +0000
@@ -18,8 +18,8 @@
  
  // ----------------------------- LED Ticker Interrupt Flasher -----------------------------------
  
-#ifndef ToggleFlasher
-#define ToggleFlasher
+#ifndef ToggleFlash
+#define ToggleFlash
 
 #include "mbed.h"
 
@@ -27,7 +27,7 @@
  *
  * Example
  * @code
- * ToggleFlasher myflasher(p20, 1.5);   // A flasher object attached to pin 20 with 1.5 second timing
+ * ToggleFlash myflasher(p20, 1.5);   // A flasher object attached to pin 20 with 1.5 second timing
  *
  * int main() {
  *     while (1) {