proyectotecnicas
/
presionRyN
parte de presión
Fork of presionRyN by
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 #include "AnalogIn.h" 00004 00005 TextLCD lcd(PTD3, PTA12, PTA4, PTA5, PTC8, PTC9, TextLCD::LCD16x2); 00006 AnalogIn presionin(PTB2); 00007 float caspresion; 00008 int BA=0,tipobanio=0,ev; 00009 Serial pc(USBTX, USBRX); 00010 00011 int main() 00012 { 00013 00014 00015 while (true) { 00016 caspresion = presionin.read() * 3.3; 00017 lcd.cls(); 00018 00019 00020 switch(tipobanio) { 00021 00022 case 0: 00023 lcd.locate(0,0); 00024 lcd.printf("Banio Rapido"); 00025 if (caspresion < 2.78 && BA == 0 ) { 00026 ev = 1; 00027 lcd.locate(0,1); 00028 lcd.printf("pres=%.2f EV= %d",caspresion,ev); 00029 } 00030 if ( caspresion >= 2.30 && BA == 0) { 00031 BA=1; 00032 ev = 0; 00033 lcd.locate(0,1); 00034 lcd.printf("pres=%.2f EV= %d",caspresion,ev); 00035 } 00036 if(caspresion <= 1.5 && BA==1 ) 00037 { 00038 BA = 0; 00039 lcd.locate(0,1); 00040 lcd.printf("pres=%.2f EV= %d",caspresion,ev); 00041 } 00042 if ( BA == 1 ) { 00043 00044 lcd.locate(0,1); 00045 lcd.printf("pres=%.2f EV= %d",caspresion,ev); 00046 } 00047 break; 00048 case 1: 00049 lcd.locate(0,0); 00050 lcd.printf("Banio Rapido"); 00051 if (caspresion < 1.70 && BA == 0 ) { 00052 ev = 1; 00053 lcd.locate(0,1); 00054 lcd.printf("pres=%.2f EV= %d",caspresion,ev); 00055 } 00056 if ( caspresion >= 1.70) { 00057 BA=1; 00058 ev = 0; 00059 lcd.locate(0,1); 00060 lcd.printf("pres=%.2f EV= %d",caspresion,ev); 00061 } 00062 if( caspresion <= 0.9 && BA==1 ) { 00063 BA = 0; 00064 lcd.locate(0,1); 00065 lcd.printf("pres=%.2f EV= %d",caspresion,ev); 00066 } 00067 if (caspresion < 1.70 && BA == 1 ) { 00068 00069 lcd.locate(0,1); 00070 lcd.printf("pres=%.2f EV= %d",caspresion,ev); 00071 } 00072 if ( BA == 1 ) { 00073 00074 lcd.locate(0,1); 00075 lcd.printf("pres=%.2f EV= %d",caspresion,ev); 00076 } 00077 00078 break; 00079 default: 00080 break; 00081 } 00082 wait(1); 00083 } 00084 }
Generated on Fri Jul 29 2022 07:05:41 by 1.7.2