Laboratorio CAD / Mbed 2 deprecated Cassaforte7

Dependencies:   mbed Servo KeypadLib TextLCD

Files at this revision

API Documentation at this revision

Comitter:
Virgi97
Date:
Mon Dec 10 19:50:47 2018 +0000
Parent:
1:0661b733846e
Child:
3:3ea339885ed8
Commit message:
Da limare

Changed in this revision

Cassaforte.cpp 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/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];
--- a/main.cpp	Sun Dec 09 22:01:57 2018 +0000
+++ b/main.cpp	Mon Dec 10 19:50:47 2018 +0000
@@ -1,6 +1,7 @@
 /*      *PINOUT E CABLAGGIO
         *5V ---> VCC MODULO I2C DISPLAY;
-        *GND ---> VCC MODULO I2C DISPLAY, CATODI LED, BUZZER-PIEZO;
+        *3.3v ----> RESISTENZA (10k) INTERRUTOTTORE MAGNETICO;
+        *GND ---> VCC MODULO I2C DISPLAY, CATODI LED, BUZZER-PIEZO, INTERRUTTORE MAGNETICO, RESISTENZE LED (220Ω);
         *PIN D15 ---> SCL MODULO I2C DISPLAY;
         *PIN D14 ---> SDA MODULO I2C DISPLAY;
         *PIN D13 ---> LED VERDE;
@@ -16,7 +17,6 @@
         *PIN D3 ---> PIN 8 TASTIERINO;
         *PIN D2 ---> BUZZER-PIEZO;
         *PIN PC_10 ---> INTERRUTTORE MAGNETICO;
-        
 */
 
 #include "Cassaforte.h"
@@ -28,7 +28,7 @@
 void scrivi(char parola[]);
 void cambioCodice();
 void inserisci();*/
-InterruptIn alarm(PC_13);
+InterruptIn alarm(PC_10);
 bool avvio = true;
 char v[4];
 int cont2;