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).
Diff: ToggleFlash.h
- Revision:
- 2:fddd1a6486bd
- Parent:
- 1:0764e2d49518
- Child:
- 3:dbd7ab16f171
--- a/ToggleFlash.h Sat Dec 22 21:14:51 2012 +0000 +++ b/ToggleFlash.h Sat Dec 22 21:19:15 2012 +0000 @@ -46,6 +46,9 @@ */ class ToggleFlash{ public: + /** Create a ToggleFlasher object connected to a pin + * @param pin The pin to which the ToggleFlasher is attached + */ ToggleFlash(PinName pin); /** Create a ToggleFlasher object connected to a pin and set the on-off time * @param pin The pin to which the ToggleFlasher is attached