LED
Dependents: Semafor Karanovic_Semafor
Revision 0:8b4a8e2414db, committed 2020-11-29
- Comitter:
- akaranovi
- Date:
- Sun Nov 29 12:09:03 2020 +0000
- Commit message:
- OK
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 8b4a8e2414db led.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/led.cpp Sun Nov 29 12:09:03 2020 +0000 @@ -0,0 +1,19 @@ +#include "led.h" +#include "mbed.h" +LED::LED(PinName pin) : _pin(pin) +{ + _pin = 0; +} + +//Metoda određuje stanje LED +void LED::status(int status) +{ + _pin = status; +} + + +//Metoda mijenja stanje na LED +void LED::flip() +{ + _pin = !_pin; +} \ No newline at end of file
diff -r 000000000000 -r 8b4a8e2414db led.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/led.h Sun Nov 29 12:09:03 2020 +0000 @@ -0,0 +1,14 @@ +#ifndef MBED_LED_H +#define MBED_LED_H +#include "mbed.h" +//Klasa za LED koja daje funkcije za mijenjanje stanja +class LED +{ +public: + LED(PinName pin); + void status(int status); + void flip(); +private: + DigitalOut _pin; +}; +#endif \ No newline at end of file