Library za upravljanje RGB LEDicom. Funkcija unutar objetkta RGBLed prima parametre koji određuju intenzitet pojedine boje u RGB (0.0 - 1.0).

Dependents:   SUSTAV_KONTROLE_PRISTUPA

Files at this revision

API Documentation at this revision

Comitter:
boki96
Date:
Sun Feb 02 10:11:43 2020 +0000
Commit message:
RGB LED management library. The function inside the RGBLed object receives parameters that determine the intensity of each color in RGB (0.0 - 1.0).

Changed in this revision

rgb.cpp Show annotated file Show diff for this revision Revisions of this file
rgb.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 8a23399d0af4 rgb.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rgb.cpp	Sun Feb 02 10:11:43 2020 +0000
@@ -0,0 +1,16 @@
+#include "rgb.h"
+#include "mbed.h"
+
+RGBLed::RGBLed (PinName crvenaPin, PinName zelenaPin, PinName plavaPin)
+    : _crvenaPin(crvenaPin), _zelenaPin(zelenaPin), _plavaPin(plavaPin)
+{
+    // Postavljanje takta na 2000 Hz
+    _crvenaPin.period(0.0005);
+}
+
+void RGBLed::prikaz(float crvena,float zelena, float plava)
+{
+    _crvenaPin = crvena;
+    _zelenaPin = zelena;
+    _plavaPin = plava;
+}
diff -r 000000000000 -r 8a23399d0af4 rgb.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rgb.h	Sun Feb 02 10:11:43 2020 +0000
@@ -0,0 +1,17 @@
+#ifndef RGB_H
+#define RGB_H
+
+#include "mbed.h"
+
+class RGBLed
+{
+    public:
+        RGBLed(PinName crvenaPin, PinName zelenaPin, PinName plavaPin);
+        void prikaz(float crvena, float zelena, float plava);
+    private:
+        PwmOut _crvenaPin;
+        PwmOut _zelenaPin;
+        PwmOut _plavaPin;
+};
+
+#endif
\ No newline at end of file