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.
Dependencies: mbed Servo KeypadLib TextLCD
main.cpp
- Committer:
- Virgi97
- Date:
- 2018-12-10
- Revision:
- 2:ca52e00afb99
- Parent:
- 1:0661b733846e
- Child:
- 3:3ea339885ed8
File content as of revision 2:ca52e00afb99:
/* *PINOUT E CABLAGGIO
*5V ---> VCC MODULO I2C DISPLAY;
*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;
*PIN D12 ---> LED ROSSO;
*PIN D11 ---> SERVO;
*PIN D10 ---> PIN 1 TASTIERINO;
*PIN D9 ---> PIN 2 TASTIERINO;
*PIN D8 ---> PIN 3 TASTIERINO;
*PIN D7 ---> PIN 4 TASTIERINO;
*PIN D6 ---> PIN 5 TASTIERINO;
*PIN D5 ---> PIN 6 TASTIERINO;
*PIN D4 ---> PIN 7 TASTIERINO;
*PIN D3 ---> PIN 8 TASTIERINO;
*PIN D2 ---> BUZZER-PIEZO;
*PIN PC_10 ---> INTERRUTTORE MAGNETICO;
*/
#include "Cassaforte.h"
#include "mbed.h"
//#include <TextLCD.h>
//I2C i2c(D14, D15);
//TextLCD_I2C lcd(&i2c, 0x4E, TextLCD_I2C::LCD16x2, TextLCD_I2C::HD44780);
/*DigitalOut led(LED1);
void scrivi(char parola[]);
void cambioCodice();
void inserisci();*/
InterruptIn alarm(PC_10);
bool avvio = true;
char v[4];
int cont2;
int main() {
alarm.rise(&controllo);
if (avvio == true){
inizializza();
avvio = false;
}
cont2=0;
do{
scrivi("Immetti codice:");
inserimento(v,4,true);
if (confronto(v,4)==true){
menu();
}
else{
scrivi("Codice errato");
wait(0.8);
cont2++;
}
}while(cont2<3);
if (cont2==3){
allarme();
}
}
/*void scrivi(char parola[]){
lcd.cls();
lcd.printf("%s\n", parola);
}
void cambioCodice(){
scrivi("Cambio codice di apertura");
lcd.setAddress(11,1);
wait(3);
lcd.cls();
scrivi("Digitare il nuo_ vo codice:");
lcd.setAddress(10,1);
inserisci();
}
void inserisci(){
wait(1);
lcd.putc('1');
wait(1);
lcd.setAddress(11,1);
lcd.putc('2');
wait(1);
lcd.setAddress(12,1);
lcd.putc('3');
wait(1);
lcd.setAddress(13,1);
lcd.putc('4');
wait(1);
}*/