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.
Revision 0:07b91fff3b06, committed 2018-09-26
- Comitter:
- hdzoisrael
- Date:
- Wed Sep 26 18:38:34 2018 +0000
- Commit message:
- Tevalevalv_42;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/42prueba.cpp Wed Sep 26 18:38:34 2018 +0000
@@ -0,0 +1,135 @@
+/*Se requiere un tablero digital implementado en un LCD. El sistema deberá mostrar la puntuación
+para un juego de hockey, en ambas porterías existen sensoresdenominado A y B que detectan
+cuando se anota un gol por lo que automáticamente se marcara el puntaje y tiene un botón para
+reiniciar la cuenta. El marcador debe ser mostrado en una pantalla como en el siguiente ejemplo:
+Linea 1 del LCD: LOCAL 05
+Linea 2 del LCD: VISITANTE 05
+*/
+#include "mbed.h"
+#include "TextLCD.h"
+
+DigitalIn local(D14);
+DigitalIn visitante(D15);
+DigitalIn reinicio(D8);
+TextLCD lcd(D2,D3,A2,A3,A4,A5); // rs, e, d4-d7
+
+int main() {
+ while(1){
+ int suma1=0;
+ int suma2=0;
+ lcd.cls();
+
+ lcd.cls();
+ for(int k=0;k<3;k++){ //adorno
+ lcd.printf("**Inicio del**\n****juego****");wait(0.5);lcd.cls();
+ lcd.printf(" \n");wait(0.3);lcd.cls();
+ }
+
+ int val=1;
+ while(val){
+ if(reinicio==1){
+ NVIC_SystemReset();
+ }
+ if(local==1){
+ suma1=suma1+1;
+ if(suma1==5){
+ for(int k=0;k<4;k++){ //adorno
+ lcd.printf("*LOCAL*\n<===========");wait(0.4);lcd.cls();
+ lcd.printf("\n************");wait(0.2);lcd.cls();
+ lcd.printf("\n*GANADOR*");wait(0.4);lcd.cls();
+ lcd.printf("************\n");wait(0.2);lcd.cls();
+ }
+ val=0; //para regresar al programa principal
+ }
+ else{
+ lcd.printf("L \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf("OL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf("OOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf("OOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf("GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL\n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOO\n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOO\n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GO\n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" G\n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" \n");wait(0.3);lcd.cls();
+ }
+ }
+ if(visitante==1){
+ suma2=suma2+1;
+ if(suma2==5){
+ for(int k=0;k<4;k++){ //adorno
+ lcd.printf("*VISITANTE*\n===========>");wait(0.4);lcd.cls();
+ lcd.printf("\n************");wait(0.2);lcd.cls();
+ lcd.printf("\n*GANADOR*");wait(0.4);lcd.cls();
+ lcd.printf("************\n");wait(0.2);lcd.cls();
+ }
+ val=0; //para regresar al programa principal
+ }
+ else{
+ lcd.printf("L \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf("OL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf("OOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf("OOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf("GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL \n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOOL\n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOOO\n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GOO\n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" GO\n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" G\n",suma1);wait(0.2);lcd.cls();
+ lcd.printf(" \n");wait(0.3);lcd.cls();
+ }
+ }
+ else{//mostrando marcador
+ lcd.printf("LOCAL= %i \nVISITANTE= %i",suma1,suma2);wait(0.2);lcd.cls();
+ lcd.printf("\n");wait(0.001);lcd.cls();
+ }//if prueba
+ }//final while var
+ //} //final if
+
+ for(int k=0;k<5;k++){ //adorno
+ lcd.printf("*JUEGO*\n*FINALIZADO*");wait(0.5);lcd.cls();
+ lcd.printf("\n");wait(0.2);lcd.cls();
+ }
+ lcd.printf("*\n");wait(0.1);lcd.cls();
+ lcd.printf(" *\n");wait(0.1);lcd.cls();
+ lcd.printf(" *\n");wait(0.1);lcd.cls();
+ lcd.printf(" *\n");wait(0.1);lcd.cls();
+ lcd.printf(" *\n");wait(0.1);lcd.cls();
+ lcd.printf(" *\n");wait(0.1);lcd.cls();
+ lcd.printf(" *\n");wait(0.1);lcd.cls();
+ lcd.printf(" *\n");wait(0.1);lcd.cls();
+ lcd.printf(" *\n");wait(0.1);lcd.cls();
+ lcd.printf(" *\n");wait(0.1);lcd.cls();
+ lcd.printf(" *\n");wait(0.1);lcd.cls();
+ lcd.printf(" *\n");wait(0.1);lcd.cls();
+ lcd.printf(" *\n");wait(0.1);lcd.cls();
+ lcd.printf(" *\n");wait(0.1);lcd.cls();
+ lcd.printf(" *\n");wait(0.1);lcd.cls();
+ lcd.printf(" *\n");wait(0.1);lcd.cls();
+ lcd.printf("\n");wait(0.2);lcd.cls();
+
+
+ }//fin if reinicio
+ } //end while (1)
+//end int
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Wed Sep 26 18:38:34 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Sep 26 18:38:34 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187 \ No newline at end of file