Jair Valdovinos / Mbed 2 deprecated puerta

Dependencies:   mbed FXOS8700Q TextLCD

Files at this revision

API Documentation at this revision

Comitter:
thesad
Date:
Thu Jun 11 02:45:08 2020 +0000
Commit message:
jejejej caiste

Changed in this revision

FXOS8700Q.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FXOS8700Q.lib	Thu Jun 11 02:45:08 2020 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/Freescale/code/FXOS8700Q/#aee7dea904e2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Thu Jun 11 02:45:08 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jun 11 02:45:08 2020 +0000
@@ -0,0 +1,149 @@
+#include "mbed.h"
+#include "C12832.h"
+
+
+DigitalOut L1(p8);
+DigitalOut L2(p9);
+DigitalOut L3(p10);
+AnalogIn pot(p15);
+C12832 lcd(SPI_MOSI, SPI_SCK, SPI_MISO, p8, p11);
+
+ 
+//Contadores para cada dígito
+int seg1=0; //Variable para contador de unidades de segundo
+int seg2=0; //Variable para contador de décimas de segundo
+int min1=0; //Variable para contador de unidades de minuto
+int min2=0; //Variable para contador de décimas de minuto
+int hor1=0; //Variable para contador de unidades de hora
+int hor2=0; //Variable para contador de décimas de hora
+ 
+void reloj(){//Subrutina para generar reloj de 6 segmentos
+    lcd.locate(21,1);//Posicionamiento de las unidades de segundo
+    lcd.printf("%i", seg1);
+    lcd.locate(11,1);//Posicionamiento de las décimas de segundo
+    lcd.printf("%i",seg2);
+    lcd.locate(26,1);//Posicionamiento del doble punto
+    lcd.printf(":");
+    lcd.locate(42,1);//Posicionamiento de las unidades de minuto
+    lcd.printf("%i",min1);
+    lcd.locate(32,1);//Posicionamiento de las décimas de minuto
+    lcd.printf("%i",min2);
+    lcd.locate(49,1);//Posicionamiento del punto doble
+    lcd.printf(":");
+    lcd.locate(63,1);//Posicionamiento de las unidades de minuto
+    lcd.printf("%i",hor1);
+    lcd.locate(53,1);//Posicionamiento de las décimas de minuto
+    lcd.printf("%i",hor2);
+}
+ 
+ 
+int main() {
+    
+     printf("Proyecto, equipo 3\n");
+     printf("Contraseña: 8569 \n");
+    float x;
+    lcd.cls();
+    while(1){
+    x = 5*pot.read();
+    
+    if(x<3.5){
+        
+    lcd.cls(); //Limpia el LCD
+    lcd.locate(15, 15); //Posiciona en columna 2, fila 0)
+    lcd.printf("Tiempo de inactividad"); //Imprime en LCD "Reloj digital"
+    lcd.copy_to_lcd();
+    
+    
+        
+        reloj(); //Llama a subrutina
+            
+        seg1++; //Inician el primer contador de unidades de segundo
+        wait(1); //Genera tiempo de un segundo
+        if (seg1==10){
+            seg2++;//Contador décimas de segundo
+            seg1=0;
+            if (seg2==6){
+                min1++;//Contador unidades de minuto
+                seg2=0;
+                if (min1==10){
+                    min2++;//Contador décimas de minuto
+                    min1=0;
+                    if(min2==6){
+                        hor1++;//Contador unidades de hora
+                        min2=0;
+                        if(hor1==10){
+                            hor2++;//Contador décimas de hora
+                            hor1=0;
+                            if((hor2==2)&&(hor1==4)){/*Cuando el contador llega
+                                                       a 24hrs, este se reinicia*/
+                                hor2=0;
+                                hor1=0;
+                            }
+                        }
+                    }
+                }
+            }
+        }  
+    }
+    
+    
+    if(x>=3.5){
+        
+ int valida = 8569;
+ int clave;
+ 
+ 
+         lcd.cls();
+        lcd.locate(1,1);
+        lcd.printf( "Introduzca su clave: ");
+        scanf("%i", &clave) ;
+   wait(1);
+    
+    if(clave != valida) {
+            
+            lcd.locate(1,15);
+            lcd.printf("No valida!");
+            lcd.copy_to_lcd();
+            L1 = 1;
+            wait(0.3);
+            L1 = 0;
+            wait(0.3);
+            L1 = 1;
+            wait(0.3);
+            L1 = 0;
+            wait(0.3);
+            L1 = 1;
+            wait(0.3);
+            L1 = 0;
+            lcd.cls();
+            clave=0;
+        } 
+    
+    if (clave == valida){
+        lcd.locate(1,15);
+        lcd.printf("Aceptada.");
+            L2 = 1;
+            L3 = 1;
+            wait(0.3);
+            L2 = 0;
+            wait(0.3);
+            L2 = 1;
+            wait(0.3);
+            L2 = 0;
+            wait(0.3);
+            L2 = 1;
+            wait(0.3);
+            L2 = 0;
+            wait(15);
+            L3 = 0;
+        
+    }
+    if (clave == 0){ 
+        lcd.cls();
+        lcd.locate(1,1);
+        lcd.printf( "No ha introducido ninguna clave");
+        
+    }
+    }
+}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jun 11 02:45:08 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file