jorge arturo juarez ornelas / Mbed 2 deprecated pruebadetablero

Dependencies:   TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
Jajo
Date:
Sun Apr 10 18:10:36 2016 +0000
Commit message:
tablero

Changed in this revision

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/TextLCD.lib	Sun Apr 10 18:10:36 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#44f34c09bd37
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Apr 10 18:10:36 2016 +0000
@@ -0,0 +1,336 @@
+#include "mbed.h"
+
+#include "TextLCD.h"
+
+Serial pc(USBTX,USBRX);
+//TextLCD lcd(PTB9, PTB10, PTE2, PTE3, PTE4, PTE5);
+TextLCD lcd(D0, D1, D2, D3, D4, D5); 
+
+
+
+DigitalIn boton1(D6);
+DigitalIn boton2(D7);
+DigitalIn boton3(D8);
+DigitalIn boton4(D9);
+DigitalIn boton6(D10);
+DigitalIn boton5(D11);
+DigitalOut alarma(D12);
+
+int horas;
+int minutos=0;
+int segundos=0;
+int segundos2=25;
+//int segundoss=0;
+int x=0;
+Timer t;
+
+Timer s;
+
+int v=0;
+int l=0;
+int p=-1;
+int z=0;
+int b,w;
+
+void reloj(){
+     
+    
+     
+     
+   
+    
+   
+    
+    if(x==1){
+        
+    s.start();
+      
+        
+        segundos2 =25- s.read();
+        
+        if(segundos2 == 0){
+            segundos2=25;
+            
+            s.reset();
+            s.start();
+            
+           
+        }  
+    
+     
+       t.start();
+        
+        segundos = t.read();
+        if(segundos == 60){
+            segundos=0;
+            t.reset();
+            minutos++;
+           
+        }
+        if(minutos==60){
+            minutos=0;
+            horas++;
+            
+        }
+        
+         
+    
+  }
+  
+   
+    
+  
+}
+
+int main(){
+   
+     
+   while(1){
+       
+       
+       
+   
+    
+     
+        
+       
+     
+        if(p==1){
+         
+       if(minutos==1){
+           alarma=1;
+           wait(1);
+           alarma=0;
+           }
+           }
+           
+        if(p==2){
+         
+       if(minutos==1){
+           alarma=1;
+           wait(1);
+           alarma=0;
+           }
+           }
+           
+        if(p==3){
+         
+       if(minutos==1){
+           alarma=1;
+           wait(1);
+           alarma=0;
+           }
+           }
+       
+       
+       if(p==4){
+         
+       if(minutos==1){
+           alarma=1;
+          
+           lcd.cls(); 
+           w=1;
+    lcd.locate(0, 0); 
+    lcd.printf("FIN DEL PARTIDO"); 
+          t.stop();
+          s.stop();
+          s.reset();
+          t.reset();
+    lcd.locate(4, 1);
+    lcd.printf("-L");
+    
+    lcd.locate(11, 1);
+    lcd.printf("V-");
+    
+    lcd.locate(13, 1);
+    lcd.printf("%d",v);
+    
+      lcd.locate(0, 1);
+    lcd.printf("%d",l);
+      
+          
+          
+          
+    
+        
+   
+            
+           }
+           
+     }else{
+         lcd.locate(0, 0); 
+    lcd.printf("T-"); 
+
+    lcd.locate(4, 1);
+    lcd.printf("-L");
+    
+    lcd.locate(11, 1);
+    lcd.printf("V-");
+    
+    
+    
+    
+    
+     
+        }
+        
+        
+    
+    
+   
+    
+    
+    
+    if(boton1==1){
+        x=1;
+         
+        
+        }
+        
+        if(boton2==1){
+        x=0;
+          t.stop();
+          s.stop();
+          s.reset();
+           segundos2=0;
+           lcd.locate(14, 0); 
+    lcd.printf("00");
+        }
+        
+        
+        
+        if(w==1){
+            wait(60);
+            }else{
+                 lcd.locate(14, 0); 
+    lcd.printf("%d",segundos2);
+    
+    
+       if(boton3==1){
+            lcd.locate(12,0);
+    lcd.printf(">");
+            
+          }else{  
+        lcd.locate(12,0);
+    lcd.printf("<");
+    
+    }
+                }
+        
+        
+        
+        if(boton2==1){
+            
+            wait(2);
+            if(boton2==1){
+          s.reset();  
+          t.reset();
+          minutos=0;
+          segundos=0;
+          segundos2=0;
+          
+          
+    
+         lcd.locate(2,0);//unidades de minuto
+    lcd.printf("%d",minutos);
+           
+             lcd.locate(5,0);//unidades de segundo
+    lcd.printf("0%d", segundos);  
+    lcd.locate(4,0);
+    lcd.printf(":");  
+    
+   
+          //imprimir ceros
+        }
+        }
+        
+        
+        
+         if(minutos<10){
+        lcd.locate(2,0);//unidades de minuto
+    lcd.printf("0%d",minutos);
+             reloj();
+            }else{
+    
+    lcd.locate(2,0);//unidades de minuto
+    lcd.printf("%d",minutos);
+    }
+    
+   reloj();
+        
+        if(segundos<10){
+          lcd.locate(5,0);//unidades de segundo
+    lcd.printf("0%d", segundos);  
+    lcd.locate(4,0);
+    lcd.printf(":");
+    
+    
+    reloj(); 
+    
+            
+            }else{
+    lcd.locate(5,0);//unidades de segundo
+    lcd.printf("%d", segundos);
+    lcd.locate(4,0);
+    lcd.printf(":");
+    
+    
+   reloj(); 
+
+}
+
+if(segundos2<10){
+          
+          lcd.locate(14, 0); 
+    lcd.printf("0%d",segundos2); 
+    
+    
+    //reloj(); 
+    
+            
+            
+    
+    
+    reloj(); 
+    
+            
+            }
+
+
+     if(boton4==1){
+            l++;
+            wait(.3);
+            lcd.locate(0, 1);
+    lcd.printf("%d",l);
+            }
+   
+            
+            if(boton5==1){
+            v++;
+            wait(.3);
+            lcd.locate(13, 1);
+    lcd.printf("%d",v);
+            }
+            
+            
+             if(boton6==1){
+                
+            p++;
+            wait(.3);
+           lcd.locate(8, 1);
+           
+   lcd.printf("%d",p);
+            }
+            
+            if(p==5){
+                p=-1;
+                
+                }
+
+  
+        
+    }
+
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Apr 10 18:10:36 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/99a22ba036c9
\ No newline at end of file