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.
43prueba.cpp
00001 /*Utilizando un LCD, teclado matricial, implemente programa que realice las función como un horno 00002 de microondas del 0 a la 9 definidas por el usuario donde la función 0 debe durar un tiempo 100seg 00003 y las opciones restantes deben ser definidas por el programador. En el LCD se debe iniciar con la 00004 leyenda Selecciona, posteriormente al oprimir la tecla debe aparecer cual oprimió, luego la función 00005 (por ejemplo 0 es igual descongelar) y deben de visualizar eltiempo que lleva al llegar a cero debe 00006 aparecer finalizado y encender un led para posteriormente volver a seleccionar, las opciones ∗ 00007 y # deben marcar no validas. 00008 */ 00009 #include "mbed.h" 00010 #include "TextLCD.h" 00011 00012 BusOut r(D8,D9,D10,D11); 00013 BusIn c(D12,D13,D14,D15); 00014 TextLCD lcd(D2,D3,A2,A3,A4,A5); // rs, e, d4-d7 00015 00016 int main() { 00017 while(1){ 00018 lcd.cls(); 00019 int T1=0; 00020 int val=1; 00021 val=1; 00022 while(val){ 00023 for (int i=0; i<4;i++){ 00024 lcd.printf("Selecciona\n");wait(0.01);lcd.cls(); 00025 r=1<<i; 00026 switch(c){//switch 1 00027 case 0x01: 00028 switch(r){ 00029 case 0x01: 00030 T1=15;lcd.printf("1 Palomitas\n");wait(1);lcd.cls();val=0;break;//1 00031 case 0x02: 00032 T1=34;lcd.printf("4 Papas\n");wait(1);lcd.cls();val=0;break;//4 00033 case 0x04: 00034 T1=5;lcd.printf("7 Pizza\n");wait(1);lcd.cls();val=0;break;//7 00035 case 0x08: 00036 lcd.printf("* no valida\n");wait(1);lcd.cls();break;//asterisco 00037 } 00038 break; 00039 case 0x02: 00040 switch(r){ 00041 case 0x01: 00042 T1=4;lcd.printf("2 Sopa\n");wait(1);lcd.cls();val=0;break;//2 00043 case 0x02: 00044 T1=7;lcd.printf("5 Vegetales\n");wait(1);lcd.cls();val=0;break;//5 00045 case 0x04: 00046 T1=21;lcd.printf("8 Granos\n");wait(1);lcd.cls();val=0;break;//8 00047 case 0x08: 00048 T1=100;lcd.printf("0 Descongelar\n");wait(1);lcd.cls();val=0;break; //0 00049 } 00050 break; 00051 case 0x04: 00052 switch(r){ 00053 case 0x01: 00054 T1=9;lcd.printf("3 Pescado\n");wait(1);lcd.cls();val=0;break;//3 00055 case 0x02: 00056 T1=6;lcd.printf("6 Dorador\n");wait(1);lcd.cls();val=0;break;//6 00057 case 0x04: 00058 T1=8;lcd.printf("9 Derretir\n");wait(1);lcd.cls();val=0;break;//9 00059 case 0x08: 00060 lcd.printf("# no valida\n");wait(1);lcd.cls();break; //# 00061 } 00062 break; 00063 case 0x08: 00064 switch(r){ 00065 case 0x01: 00066 wait(0.1);break;//A 00067 case 0x02: 00068 wait(0.1);break;//B 00069 case 0x04: 00070 wait(0.1);break;//C 00071 case 0x08: 00072 wait(0.1);break; //D 00073 } //end switch2 00074 break; 00075 default: 00076 wait(0.001); 00077 break; 00078 }//end switch1 00079 }//end for 00080 }//end while val 00081 00082 for(int k=0;k<5;k++){ //adorno 00083 lcd.printf("*******\n");wait(0.2);lcd.cls(); 00084 lcd.printf(" \n");wait(0.3);lcd.cls(); 00085 } 00086 00087 for(int k=0;k<4;k++){ //mostrando el tiempo que tomará 00088 lcd.printf("%i \n",T1);wait(0.7);lcd.cls(); 00089 lcd.printf(" \n");wait(0.3);lcd.cls(); 00090 } 00091 00092 for (int l=T1; l > 0; l--){ //Cuenta 00093 lcd.printf("%i \n",l);wait(1);lcd.cls(); 00094 } 00095 00096 for(int k=0;k<5;k++){ //adorno 00097 lcd.printf("*FINALIZADO*\n");wait(0.5);lcd.cls(); 00098 lcd.printf("************\n");wait(0.5);lcd.cls(); 00099 } 00100 00101 } //end while (1) 00102 }//end int
Generated on Tue Aug 2 2022 05:47:46 by
1.7.2