Simple library, creates LED object using LED class, and gives it flip function that changes its value from 0 to 1 and vice versa.
Revision 0:f7dc5fd660f6, committed 2020-11-15
- Comitter:
- khodak
- Date:
- Sun Nov 15 18:55:08 2020 +0000
- Commit message:
- Simple led library that creates object LED with LED class and has a flip method to flip LED value from 0 to 1 and vice versa.
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 f7dc5fd660f6 led.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/led.cpp Sun Nov 15 18:55:08 2020 +0000 @@ -0,0 +1,11 @@ +#include "led.h" +#include "mbed.h" +LED::LED(PinName pin) : _pin(pin) +{ + _pin = 0; +} +//Metoda mijenja stanje na LED +void LED::flip() +{ + _pin = !_pin; +}
diff -r 000000000000 -r f7dc5fd660f6 led.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/led.h Sun Nov 15 18:55:08 2020 +0000 @@ -0,0 +1,13 @@ +#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 flip(); +private: + DigitalOut _pin; +}; +#endif \ No newline at end of file