Completo

Dependencies:   mbed Servo KeypadLib TextLCD

Revision:
2:ca52e00afb99
Parent:
1:0661b733846e
diff -r 0661b733846e -r ca52e00afb99 Cassaforte.cpp
--- a/Cassaforte.cpp	Sun Dec 09 22:01:57 2018 +0000
+++ b/Cassaforte.cpp	Mon Dec 10 19:50:47 2018 +0000
@@ -12,7 +12,7 @@
 DigitalOut led_verde(D13);  //led apertura
 DigitalOut led_rosso(D12);  //led chiusura
 DigitalOut buz(D2); //porta buz
-DigitalIn mag(PC_13); //porta del magnete
+DigitalIn mag(PC_10); //porta del magnete
 int dim=4;
 //int buz=0;
 char pass[4]={'1','2','3','4'};//password di default (è possibile cambiarla dal menu)
@@ -24,10 +24,13 @@
     lcd.setBacklight(TextLCD_I2C::LightOff);
     buz=0;
     
-    if(mag == 1){
+    if(mag == 0){
         chiuso();
         //wait(0.3);
-        } else aperto();
+        } else {
+            aperto();
+            alonoff = false;
+            }
     //lcd.setCursor(TextLCD_I2C::CurOn_BlkOn);
     }
 
@@ -115,7 +118,11 @@
             chiuso();      
             wait(0.3);   //2
             main();
-            }
+            }else{
+                scrivi("Chiudere la     porta");
+                wait(1);
+                menu();
+                }
         }
     if(val=='C'){       
         char v[dim];