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
Diff: main.cpp
- Revision:
- 1:0661b733846e
- Parent:
- 0:376d7a150177
- Child:
- 2:ca52e00afb99
--- a/main.cpp Wed Dec 03 03:48:48 2014 +0000
+++ b/main.cpp Sun Dec 09 22:01:57 2018 +0000
@@ -1,20 +1,89 @@
-#include "mbed.h"
-#include "TextLCD.h"
-//Incluye resistencias de 2.2K en los pines de i2c a 3.3
-
-
+/* *PINOUT E CABLAGGIO
+ *5V ---> VCC MODULO I2C DISPLAY;
+ *GND ---> VCC MODULO I2C DISPLAY, CATODI LED, BUZZER-PIEZO;
+ *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;
+
+*/
-// I2C Communication
-I2C i2c_lcd(p28,p27); // SDA, SCL
-
-TextLCD_I2C lcd(&i2c_lcd, 0x4E, TextLCD::LCD16x2, TextLCD::HD44780); // I2C bus, PCF8574 Slaveaddress, LCD Type, Device Type
-
+#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_13);
+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();
+ }
+
+}
-int main()
-{
-lcd.setMode(TextLCD::DispOn); //DispOff, DispOn
-lcd.setBacklight(TextLCD::LightOff);//LightOff, LightOn
-lcd.setCursor(TextLCD::CurOff_BlkOff);//CurOff_BlkOff, CurOn_BlkOff, CurOff_BlkOn, CurOn_BlkOn
-lcd.printf("Oscar de Jesus \n Vasquez");
-
- }
\ No newline at end of file
+/*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);
+ }*/
\ No newline at end of file