akuygry
Dependencies: mbed Servo KeypadLib TextLCD
Cassaforte.cpp
- Committer:
- Virgi97
- Date:
- 2018-12-04
- Revision:
- 0:5f8790dfc90c
- Child:
- 1:02c938489de7
File content as of revision 0:5f8790dfc90c:
#include "Cassaforte.h" #include "TextLCD.h" #include "Servo.h" I2C i2c(D14, D15); //InterruptIn button(PC_13); TextLCD_I2C lcd(&i2c, 0x4E, TextLCD_I2C::LCD16x2, TextLCD_I2C::HD44780); DigitalOut led(LED1); Servo servo(D3); bool sensore = false; void inizializza(){ lcd.setMode(TextLCD_I2C::DispOn); lcd.setCursor(TextLCD_I2C::CurOn_BlkOn); if (sensore == true) chiuso(); else aperto(); } void scrivi(char parola[]){ lcd.cls(); lcd.printf("%s\n", parola); } void cambioCodice(){ led=!led; scrivi("Cambio codice di apertura"); lcd.setAddress(11,1); wait(3); lcd.cls(); scrivi("Digitare il nuo_vo codice:"); lcd.setAddress(10,1); inserimento(); led=!led; } void inserimento(){ /*for (int i=0; i<4; i++){ wait(1); lcd.putc(i); wait(1); lcd.setAddress(11+i,1); }*/ 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); } void chiuso(){ servo.position(-90); } void aperto(){ servo.position(-90); }