Nadzor opterećenja sustava. Na 10% vrijednosti pali se zelena LED dioda, na 50% pali se žuta, na 80% pali se crvena, na 90% sve diode se pale i gase. Pritiskom na pushbutton pali se alarmna led dioda.

https://os.mbed.com/media/uploads/nikolarp/shema_fb_thumb.jpg

Files at this revision

API Documentation at this revision

Comitter:
nikolarp
Date:
Thu Apr 08 12:25:44 2021 +0000
Parent:
2:49f00e7e7913
Commit message:
.

Changed in this revision

IO.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/IO.h	Mon Apr 05 17:52:54 2021 +0000
+++ b/IO.h	Thu Apr 08 12:25:44 2021 +0000
@@ -4,7 +4,7 @@
 DigitalOut zelena(D7);
 DigitalOut Alarm(D3);
 AnalogIn Ain(D11);
-InterruptIn button(PC_13);
+InterruptIn button(PC_13); //kreira funkcija InteruptIn povezanu na navedeni priključak
 void LED(){
     
     }
\ No newline at end of file
--- a/main.cpp	Mon Apr 05 17:52:54 2021 +0000
+++ b/main.cpp	Thu Apr 08 12:25:44 2021 +0000
@@ -2,23 +2,25 @@
 #include "IO.h"
 #include "SegDisplay.h"
 Serial pc(USBTX, USBRX);
-Ticker flip;
-Timer debounce;
-float ADCdata;
-void toggle(){
+Ticker flip; 
+Timer debounce; 
+float ADCdata; 
+void toggle(){ 
     if (debounce.read_ms()>200) 
         Alarm=!Alarm;       
         }        
-void flip1(){
+void flip1(){ //
     crvena = !crvena;
     zelena = !zelena;
     zuta =!zuta;
+    wait(0.6);
+    flip.detach(); 
     }
 int main(){
-    LED();
+    LED(); 
     SegInit();
     debounce.start();
-button.rise(&toggle);
+    button.rise(&toggle); 
     while (1) 
     {    
 ADCdata=Ain;
@@ -44,9 +46,7 @@
     crvena=0;
 }
 else if(ADCdata>=0.9 && ADCdata<=1.0){   
-    flip.attach(&flip1, 0.2);
-    wait(0.4);
-    flip.detach();
+    flip.attach(&flip1,0.1); 
 }
 Seg1 = SegConvert(ADCdata*10);
 wait (0.5);