Library za LED funkcionalnosti.
Revision 0:1de9ab3bde7d, committed 2021-02-23
- Comitter:
- asantek
- Date:
- Tue Feb 23 11:46:47 2021 +0000
- Commit message:
- Library dodan.
Changed in this revision
led.cpp | Show annotated file Show diff for this revision Revisions of this file |
led.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 1de9ab3bde7d led.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/led.cpp Tue Feb 23 11:46:47 2021 +0000 @@ -0,0 +1,19 @@ +#include "led.h" +#include "mbed.h" +LED::LED(PinName pin) : _pin(pin) +{ + _pin = 0; +} + +//Metoda određuje stanje +void LED::stanje(int stanje) +{ + _pin = stanje; +} + +//Metoda mjenja stanje +void LED::promijeni() +{ + _pin = !_pin; +} + \ No newline at end of file
diff -r 000000000000 -r 1de9ab3bde7d led.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/led.h Tue Feb 23 11:46:47 2021 +0000 @@ -0,0 +1,14 @@ +#ifndef LED_H +#define LED_H +#include "mbed.h" +//Klasa koja daje funkcije za mjenjanje stanja +class LED +{ +public: + LED(PinName pin); + void stanje(int stanje); + void promijeni(); +private: + DigitalOut _pin; +}; +#endif \ No newline at end of file