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.
main.cpp
00001 #include "mbed.h" 00002 #include "AnalogIn.h" 00003 #include "TextLCD.h" 00004 00005 Serial pc(USBTX, USBRX); 00006 AnalogIn externo(PTC2); 00007 AnalogIn interno(PTB3); 00008 InterruptIn sw1(SW1); 00009 DigitalIn sw3(SW3); 00010 DigitalIn llave(PTA1); 00011 00012 00013 TextLCD lcd(PTD3, PTA12, PTA4, PTA5, PTC8, PTC9, TextLCD::LCD16x2); 00014 00015 int sel = 0; 00016 int temp = 26; 00017 char tipo; 00018 00019 void menu (){ 00020 if(llave == 0){ //modo auto 00021 wait(1); 00022 lcd.cls(); 00023 do{ 00024 lcd.locate(0,0); 00025 lcd.printf("temperatura"); 00026 }while(sw1 == 1 && sw3 == 1); 00027 if(sw3 == 0){ 00028 lcd.cls(); 00029 wait(.5); 00030 pc.printf("ingrese temperatura\r\n"); 00031 pc.scanf("%d", &temp); 00032 pc.printf("se seteo la temperatura a %.0d\r\n", temp); 00033 } 00034 else{ 00035 lcd.cls(); 00036 do{ 00037 lcd.locate(0,0); 00038 lcd.printf("tipo de banio"); 00039 }while(sw1 == 1 && sw3 == 1); 00040 if(sw3 == 0){ 00041 wait(.20); 00042 pc.scanf("%c", &tipo); 00043 pc.printf("el tipo de banio es %c\r\n", tipo); 00044 } 00045 else{ 00046 lcd.cls(); 00047 do{ 00048 lcd.locate(0,0); 00049 lcd.printf("horarios"); 00050 wait(.20); 00051 }while(sw1 == 1 && sw3 == 1); 00052 if(sw3 == 0){ 00053 wait(.20); 00054 } 00055 else{ 00056 wait(.15); 00057 lcd.cls(); 00058 do{ 00059 lcd.locate(0,0); 00060 lcd.printf("reloj"); 00061 wait(.20); 00062 }while(sw1 == 1 && sw3 == 1); 00063 if(sw3 == 0){ 00064 wait(1); 00065 } 00066 else{ 00067 lcd.cls(); 00068 do{ 00069 lcd.locate(0,0); 00070 lcd.printf("salir"); 00071 wait(0.20); 00072 }while(sw1 == 1 && sw3 == 1); 00073 if(sw3 == 0){ 00074 wait(.20); 00075 return; 00076 } 00077 else{ 00078 menu(); 00079 }}}}}} 00080 else{ 00081 lcd.cls(); 00082 lcd.printf("move la llave"); 00083 lcd.locate(0,1); 00084 lcd.printf("pequenio puto"); 00085 } //llave fin else principal 00086 } //llave de fin funcion 00087 int main() { 00088 00089 pc.baud(115200); 00090 00091 float casinterno; 00092 float casexterno; 00093 float tinterno; 00094 float texterno; 00095 int comp; 00096 00097 while(1){ 00098 sw1.fall(&menu); 00099 lcd.cls(); 00100 00101 if(llave == 0){ 00102 lcd.locate(8,1); 00103 lcd.printf("Auto"); 00104 }else { 00105 lcd.locate(8,1); 00106 lcd.printf("man"); 00107 } 00108 casexterno = externo.read() * 3.3; 00109 texterno = (casexterno + 0.2) * 100 / 5; 00110 00111 casinterno = interno.read() * 3.3; 00112 tinterno = (casinterno + 2) * 100 / 8; 00113 lcd.locate(0,0); 00114 lcd.printf("int %.0f set %d",tinterno, temp); 00115 lcd.locate(0,1); 00116 lcd.printf("ext %.0f ", texterno); 00117 comp = tinterno; 00118 if(comp == temp) 00119 pc.printf("las temperaturas son iguales\n\r"); 00120 else 00121 pc.printf("temperaturas distintas\n\r"); 00122 wait(1); 00123 } 00124 }
Generated on Fri Jul 22 2022 18:48:55 by
1.7.2