A

Dependencies:   mbed Servo KeypadLib TextLCD

Committer:
AndreaS97
Date:
Wed Dec 05 20:25:42 2018 +0000
Revision:
2:74c155c71eb5
Parent:
1:02c938489de7
Child:
3:c64c5ac14d22
Cassaforte 5.12.18

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Virgi97 0:5f8790dfc90c 1 #include "Cassaforte.h"
AndreaS97 1:02c938489de7 2 #include "mbed.h"
Virgi97 0:5f8790dfc90c 3 //#include <TextLCD.h>
Virgi97 0:5f8790dfc90c 4 //I2C i2c(D14, D15);
Virgi97 0:5f8790dfc90c 5 //TextLCD_I2C lcd(&i2c, 0x4E, TextLCD_I2C::LCD16x2, TextLCD_I2C::HD44780);
Virgi97 0:5f8790dfc90c 6 /*DigitalOut led(LED1);
Virgi97 0:5f8790dfc90c 7 void scrivi(char parola[]);
Virgi97 0:5f8790dfc90c 8 void cambioCodice();
Virgi97 0:5f8790dfc90c 9 void inserisci();*/
Virgi97 0:5f8790dfc90c 10 InterruptIn button(PC_13);
AndreaS97 1:02c938489de7 11 char v[4];
AndreaS97 2:74c155c71eb5 12 int cont2;
Virgi97 0:5f8790dfc90c 13 int main() {
Virgi97 0:5f8790dfc90c 14 /*lcd.setMode(TextLCD_I2C::DispOn);
Virgi97 0:5f8790dfc90c 15 lcd.setCursor(TextLCD_I2C::CurOn_BlkOn);*/
Virgi97 0:5f8790dfc90c 16 inizializza();
AndreaS97 2:74c155c71eb5 17 cont2=0;
AndreaS97 2:74c155c71eb5 18 do{
AndreaS97 1:02c938489de7 19 scrivi("Immetti codice:");
AndreaS97 2:74c155c71eb5 20 inserimento(v,4,true);
AndreaS97 2:74c155c71eb5 21 if (confronto(v,4)==true){
AndreaS97 2:74c155c71eb5 22 menu();
AndreaS97 2:74c155c71eb5 23 }
AndreaS97 2:74c155c71eb5 24 else{
AndreaS97 2:74c155c71eb5 25 scrivi("Codice errato");
AndreaS97 2:74c155c71eb5 26 wait(0.8);
AndreaS97 2:74c155c71eb5 27 cont2++;
AndreaS97 2:74c155c71eb5 28 }
AndreaS97 2:74c155c71eb5 29 }while(cont2<3);
AndreaS97 1:02c938489de7 30
AndreaS97 2:74c155c71eb5 31 if (cont2==3){
AndreaS97 2:74c155c71eb5 32 allarme();
AndreaS97 2:74c155c71eb5 33 }
Virgi97 0:5f8790dfc90c 34 }
Virgi97 0:5f8790dfc90c 35
Virgi97 0:5f8790dfc90c 36 /*void scrivi(char parola[]){
Virgi97 0:5f8790dfc90c 37 lcd.cls();
Virgi97 0:5f8790dfc90c 38 lcd.printf("%s\n", parola);
Virgi97 0:5f8790dfc90c 39 }
Virgi97 0:5f8790dfc90c 40
Virgi97 0:5f8790dfc90c 41 void cambioCodice(){
Virgi97 0:5f8790dfc90c 42 scrivi("Cambio codice di apertura");
Virgi97 0:5f8790dfc90c 43 lcd.setAddress(11,1);
Virgi97 0:5f8790dfc90c 44 wait(3);
Virgi97 0:5f8790dfc90c 45 lcd.cls();
Virgi97 0:5f8790dfc90c 46 scrivi("Digitare il nuo_ vo codice:");
Virgi97 0:5f8790dfc90c 47 lcd.setAddress(10,1);
Virgi97 0:5f8790dfc90c 48 inserisci();
Virgi97 0:5f8790dfc90c 49 }
Virgi97 0:5f8790dfc90c 50
Virgi97 0:5f8790dfc90c 51 void inserisci(){
Virgi97 0:5f8790dfc90c 52 wait(1);
Virgi97 0:5f8790dfc90c 53 lcd.putc('1');
Virgi97 0:5f8790dfc90c 54 wait(1);
Virgi97 0:5f8790dfc90c 55 lcd.setAddress(11,1);
Virgi97 0:5f8790dfc90c 56 lcd.putc('2');
Virgi97 0:5f8790dfc90c 57 wait(1);
Virgi97 0:5f8790dfc90c 58 lcd.setAddress(12,1);
Virgi97 0:5f8790dfc90c 59 lcd.putc('3');
Virgi97 0:5f8790dfc90c 60 wait(1);
Virgi97 0:5f8790dfc90c 61 lcd.setAddress(13,1);
Virgi97 0:5f8790dfc90c 62 lcd.putc('4');
Virgi97 0:5f8790dfc90c 63 wait(1);
Virgi97 0:5f8790dfc90c 64 }*/