Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:f6989b7f3cd3, committed 2021-09-21
- Comitter:
- fjakic
- Date:
- Tue Sep 21 15:31:14 2021 +0000
- Commit message:
- Final
Changed in this revision
| ledSignalizacija.cpp | Show annotated file Show diff for this revision Revisions of this file |
| ledSignalizacija.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ledSignalizacija.cpp Tue Sep 21 15:31:14 2021 +0000
@@ -0,0 +1,36 @@
+#include "ledSignalizacija.h"
+
+LedSignalizacija::LedSignalizacija(PinName pinGreenLed, PinName pinYelowLed, PinName pinRedLed): _greenLed(pinGreenLed), _yelowLed(pinYelowLed), _redLed(pinRedLed)
+{
+ _greenLed = 0;
+ _yelowLed = 0;
+ _redLed = 0;
+}
+
+void LedSignalizacija::postaviLedSignalizaciju(float razinaTemperature)
+{
+ if(razinaTemperature <= 0.5){
+ _greenLed.write(1);
+ _yelowLed.write(0);
+ _redLed.write(0);
+ }
+ else if(razinaTemperature > 0.5 && razinaTemperature < 0.8){
+ _greenLed.write(0);
+ _yelowLed.write(1);
+ _redLed.write(0);
+ }
+ else {
+ _greenLed.write(0);
+ _yelowLed.write(0);
+ _redLed.write(1);
+ }
+}
+
+void LedSignalizacija::upaliSveLedice(int vrijemeRada)
+{
+ _greenLed.write(1);
+ _yelowLed.write(1);
+ _redLed.write(1);
+ wait(vrijemeRada);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ledSignalizacija.h Tue Sep 21 15:31:14 2021 +0000
@@ -0,0 +1,17 @@
+#include "mbed.h"
+#ifndef LEDSIGNALIZACIJA_H
+#define LEDSIGNALIZACIJA_H
+
+class LedSignalizacija
+{
+public:
+ LedSignalizacija(PinName pinGreenLed, PinName pinYelowLed, PinName pinRedLed);
+ void postaviLedSignalizaciju(float razinaTemperature);
+ void upaliSveLedice(int vrijemeRada);
+
+private:
+ DigitalOut _greenLed;
+ DigitalOut _yelowLed;
+ DigitalOut _redLed;
+};
+#endif
\ No newline at end of file