Simple library for LED blinking.
Dependents: roam_v2 finalV1 finalV1 finalv2 ... more
Diff: Blinker.h
- Revision:
- 3:286a364f952f
- Parent:
- 2:190915d53c0b
- Child:
- 4:abcdbfe38247
diff -r 190915d53c0b -r 286a364f952f Blinker.h --- a/Blinker.h Sun Nov 15 09:12:51 2015 +0000 +++ b/Blinker.h Sat Dec 10 14:39:42 2016 +0000 @@ -24,13 +24,30 @@ * @endcode */ class Blinker { -private: - DigitalOut myled; + public: + /** Constructor receives a pin name that LED is connected to. */ Blinker(PinName pin); + /** Function recevies number of blinks (flashes) and a time of duration of each blink. */ void blink(int n, float t = 0.5); + /** Checks if the blinking is finished. + * @returns true if the complete process is finished, false otherwise. + */ + bool isFinished(); + +private: + + DigitalOut myled; + int i, N; + float period; + Ticker ticker; + Timeout timeout; + bool finished, almostFinished; + void turnLedOff(); + void turnLedOn(); + void done(); }; #endif \ No newline at end of file