Biblioteka za ledice

Files at this revision

API Documentation at this revision

Comitter:
petarcicvaric
Date:
Wed Dec 01 07:20:49 2021 +0000
Commit message:
Biblioteka za ledice

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 723bf76017a4 led.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/led.cpp	Wed Dec 01 07:20:49 2021 +0000
@@ -0,0 +1,19 @@
+#include "led.h"
+#include "mbed.h"
+LED::LED(PinName pin) : _pin(pin)
+{
+    _pin = 0;
+}
+
+//Određivanje stanja
+void LED::stanje(int stanje)
+{
+    _pin = stanje;
+}
+
+//Mjenjanje stanja
+void LED::promijeni()
+{
+    _pin = !_pin;
+}
+   
\ No newline at end of file
diff -r 000000000000 -r 723bf76017a4 led.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/led.h	Wed Dec 01 07:20:49 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