blin
Revision 0:cf737240fac5, committed 2021-03-02
- Comitter:
- ijajcevic
- Date:
- Tue Mar 02 22:34:47 2021 +0000
- Commit message:
- za blink
Changed in this revision
blinkalo.cpp | Show annotated file Show diff for this revision Revisions of this file |
blinkalo.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r cf737240fac5 blinkalo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/blinkalo.cpp Tue Mar 02 22:34:47 2021 +0000 @@ -0,0 +1,13 @@ +#include "blinkalo.h" +#include "mbed.h" + +blinkalo::blinkalo(PinName pin) : _pin(pin) { + _pin = 0; +} + +void blinkalo::blink(int n) { + for(int i=0; i<n*2; i++) { + _pin = !_pin; + wait(0.5); + } +} \ No newline at end of file
diff -r 000000000000 -r cf737240fac5 blinkalo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/blinkalo.h Tue Mar 02 22:34:47 2021 +0000 @@ -0,0 +1,15 @@ +#ifndef BLINKALO_H +#define BLINKALO_H + +#include "mbed.h" + +class blinkalo { +public: + blinkalo(PinName pin); + void blink(int n); + +private: + DigitalOut _pin; +}; + +#endif