A
Dependencies: mbed Servo KeypadLib TextLCD
main.cpp@0:5f8790dfc90c, 2018-12-04 (annotated)
- Committer:
- Virgi97
- Date:
- Tue Dec 04 10:11:08 2018 +0000
- Revision:
- 0:5f8790dfc90c
- Child:
- 1:02c938489de7
Cassciaforte
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Virgi97 | 0:5f8790dfc90c | 1 | #include "Cassaforte.h" |
Virgi97 | 0:5f8790dfc90c | 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); |
Virgi97 | 0:5f8790dfc90c | 11 | |
Virgi97 | 0:5f8790dfc90c | 12 | int main() { |
Virgi97 | 0:5f8790dfc90c | 13 | /*lcd.setMode(TextLCD_I2C::DispOn); |
Virgi97 | 0:5f8790dfc90c | 14 | lcd.setCursor(TextLCD_I2C::CurOn_BlkOn);*/ |
Virgi97 | 0:5f8790dfc90c | 15 | inizializza(); |
Virgi97 | 0:5f8790dfc90c | 16 | button.rise(&cambioCodice); |
Virgi97 | 0:5f8790dfc90c | 17 | while(1) { |
Virgi97 | 0:5f8790dfc90c | 18 | scrivi("Cassaforte"); |
Virgi97 | 0:5f8790dfc90c | 19 | wait(0.2); |
Virgi97 | 0:5f8790dfc90c | 20 | } |
Virgi97 | 0:5f8790dfc90c | 21 | } |
Virgi97 | 0:5f8790dfc90c | 22 | |
Virgi97 | 0:5f8790dfc90c | 23 | /*void scrivi(char parola[]){ |
Virgi97 | 0:5f8790dfc90c | 24 | lcd.cls(); |
Virgi97 | 0:5f8790dfc90c | 25 | lcd.printf("%s\n", parola); |
Virgi97 | 0:5f8790dfc90c | 26 | } |
Virgi97 | 0:5f8790dfc90c | 27 | |
Virgi97 | 0:5f8790dfc90c | 28 | void cambioCodice(){ |
Virgi97 | 0:5f8790dfc90c | 29 | scrivi("Cambio codice di apertura"); |
Virgi97 | 0:5f8790dfc90c | 30 | lcd.setAddress(11,1); |
Virgi97 | 0:5f8790dfc90c | 31 | wait(3); |
Virgi97 | 0:5f8790dfc90c | 32 | lcd.cls(); |
Virgi97 | 0:5f8790dfc90c | 33 | scrivi("Digitare il nuo_ vo codice:"); |
Virgi97 | 0:5f8790dfc90c | 34 | lcd.setAddress(10,1); |
Virgi97 | 0:5f8790dfc90c | 35 | inserisci(); |
Virgi97 | 0:5f8790dfc90c | 36 | } |
Virgi97 | 0:5f8790dfc90c | 37 | |
Virgi97 | 0:5f8790dfc90c | 38 | void inserisci(){ |
Virgi97 | 0:5f8790dfc90c | 39 | wait(1); |
Virgi97 | 0:5f8790dfc90c | 40 | lcd.putc('1'); |
Virgi97 | 0:5f8790dfc90c | 41 | wait(1); |
Virgi97 | 0:5f8790dfc90c | 42 | lcd.setAddress(11,1); |
Virgi97 | 0:5f8790dfc90c | 43 | lcd.putc('2'); |
Virgi97 | 0:5f8790dfc90c | 44 | wait(1); |
Virgi97 | 0:5f8790dfc90c | 45 | lcd.setAddress(12,1); |
Virgi97 | 0:5f8790dfc90c | 46 | lcd.putc('3'); |
Virgi97 | 0:5f8790dfc90c | 47 | wait(1); |
Virgi97 | 0:5f8790dfc90c | 48 | lcd.setAddress(13,1); |
Virgi97 | 0:5f8790dfc90c | 49 | lcd.putc('4'); |
Virgi97 | 0:5f8790dfc90c | 50 | wait(1); |
Virgi97 | 0:5f8790dfc90c | 51 | }*/ |