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 InterruptIn sw3(SW3); 00010 DigitalIn llave(PTA1); 00011 00012 00013 TextLCD lcd(PTD3, PTA12, PTA4, PTA5, PTC8, PTC9, TextLCD::LCD16x2); 00014 00015 int temp = 26; 00016 char tipo; 00017 int sel = 1; 00018 float casinterno; 00019 float casexterno; 00020 float tinterno; 00021 float texterno; 00022 char modo = 'M'; 00023 00024 void menu (){ 00025 lcd.cls(); 00026 switch (sel){ 00027 case 1: 00028 lcd.locate(0,0); 00029 lcd.printf("auto"); 00030 lcd.locate(0,1); 00031 lcd.printf("%.0fC %.0fC %c ho:ra", texterno, tinterno, modo); 00032 sel = 2; 00033 break; 00034 case 2: 00035 lcd.locate(0,0); 00036 lcd.printf("manual"); 00037 lcd.locate(0,1); 00038 lcd.printf("%.0fC %.0fC %c ho:ra", texterno, tinterno, modo); 00039 sel = 3; 00040 break; 00041 case 3: 00042 lcd.locate(0,0); 00043 lcd.printf("reloj"); 00044 lcd.locate(0,1); 00045 lcd.printf("%.0fC %.0fC %c ho:ra", texterno, tinterno, modo); 00046 sel = 1; 00047 break; 00048 case 4: 00049 lcd.locate(0,0); 00050 lcd.printf("temperatura"); 00051 lcd.locate(0,1); 00052 lcd.printf("%.0fC %.0fC %c ho:ra", texterno, tinterno, modo); 00053 sel = 5; 00054 break; 00055 case 5: 00056 lcd.locate(0,0); 00057 lcd.printf("tipo banio"); 00058 lcd.locate(0,1); 00059 lcd.printf("%.0fC %.0fC %c ho:ra", texterno, tinterno, modo); 00060 sel = 6; 00061 break; 00062 case 6: 00063 lcd.locate(0,0); 00064 lcd.printf("horarios"); 00065 lcd.locate(0,1); 00066 lcd.printf("%.0fC %.0fC %c ho:ra", texterno, tinterno, modo); 00067 sel = 9; 00068 break; 00069 case 7: 00070 lcd.locate(0,0); 00071 lcd.printf("temperatura"); 00072 lcd.locate(0,1); 00073 lcd.printf("%.0fC %.0fC %c ho:ra", texterno, tinterno, modo); 00074 sel = 8; 00075 break; 00076 case 8: 00077 lcd.locate(0,0); 00078 lcd.printf("tipo banio"); 00079 lcd.locate(0,1); 00080 lcd.printf("%.0fC %.0fC %c ho:ra", texterno, tinterno, modo); 00081 sel = 10; 00082 break; 00083 case 9: 00084 lcd.locate(0,0); 00085 lcd.printf("salir"); 00086 lcd.locate(0,1); 00087 lcd.printf("%.0fC %.0fC %c ho:ra", texterno, tinterno, modo); 00088 sel = 4; 00089 break; 00090 case 10: 00091 lcd.locate(0,0); 00092 lcd.printf("salir"); 00093 lcd.locate(0,1); 00094 lcd.printf("%.0fC %.0fC %c ho:ra", texterno, tinterno, modo); 00095 sel = 7; 00096 break; 00097 } 00098 } 00099 00100 void selec(){ 00101 switch (sel){ 00102 case 2: 00103 modo = 'A'; 00104 sel = 4; 00105 menu(); 00106 break; 00107 case 3: 00108 modo = 'M'; 00109 sel = 7; 00110 menu(); 00111 break; 00112 case 1: 00113 pc.printf("aca ingresaria la hora\r\n"); 00114 wait(1.5); 00115 break; 00116 case 5: 00117 pc.printf("aca ingresaria la temperatura\r\n"); 00118 wait(1.5); 00119 break; 00120 case 6: 00121 pc.printf("aca ingresaria el tipo de banio\r\n"); 00122 wait(1.5); 00123 break; 00124 case 4: 00125 sel = 1; 00126 menu(); //salida1 00127 break; 00128 case 8: 00129 pc.printf("aca ingresaria la temperatura2\r\n"); 00130 wait(1.5); 00131 break; 00132 case 7: 00133 sel = 2; 00134 menu(); 00135 break; 00136 case 9: 00137 pc.printf("aca ingresaria el horario\r\n"); 00138 wait(1.5); 00139 break; 00140 case 10: 00141 pc.printf("aca ingresaria tipo banio\r\n"); 00142 wait(1.5); 00143 break; 00144 } 00145 00146 } 00147 00148 int main() { 00149 00150 pc.baud(115200); 00151 00152 int comp; 00153 00154 while(1){ 00155 00156 sw1.fall(&menu); 00157 sw3.fall(&selec); 00158 //convierte voltaje a temperatura 00159 casexterno = externo.read() * 3.3; 00160 texterno = (casexterno + 0.2) * 100 / 5; 00161 casinterno = interno.read() * 3.3; 00162 tinterno = (casinterno + 2) * 100 / 8; 00163 00164 lcd.locate(0,1); 00165 lcd.printf("%.0fC %.0fC %c ho:ra", texterno, tinterno, modo); 00166 00167 comp = tinterno; 00168 if(comp == temp) 00169 pc.printf("las temperaturas son iguales\n\r"); 00170 else 00171 pc.printf("temperaturas distintas\n\r"); 00172 wait(1); 00173 } 00174 }
Generated on Wed Jul 13 2022 12:28:50 by
1.7.2