lee las 2 temperaturas y de la terminal la deseada imprime en el lcd lsa 2 temperetaturas, la deseada y en la terminal imprime si la interna es igual o distinta a la deseada
Revision 0:05e7963d2ae2, committed 2015-11-28
- Comitter:
- josedaparte
- Date:
- Sat Nov 28 12:20:53 2015 +0000
- Commit message:
- culiau
Changed in this revision
diff -r 000000000000 -r 05e7963d2ae2 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Sat Nov 28 12:20:53 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
diff -r 000000000000 -r 05e7963d2ae2 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Nov 28 12:20:53 2015 +0000 @@ -0,0 +1,47 @@ +#include "mbed.h" +#include "AnalogIn.h" +#include "TextLCD.h" + +Serial pc(USBTX, USBRX); +AnalogIn externo(PTC2); +AnalogIn interno(PTB3); + +TextLCD lcd(PTD3, PTA12, PTA4, PTA5, PTC8, PTC9, TextLCD::LCD16x2); + +int temp = 26; + +void recibedato(){ + pc.scanf("%d", &temp); + pc.printf("se seteo la temperatura a %.0d\r\n", temp); + } + +int main() { + + pc.baud(115200); + pc.attach(&recibedato); + + float casinterno; + float casexterno; + float tinterno; + float texterno; + int comp; + + while(1){ + lcd.cls(); + casexterno = externo.read() * 3.3; + texterno = (casexterno + 0.2) * 100 / 5; + + casinterno = interno.read() * 3.3; + tinterno = (casinterno + 2) * 100 / 8; + + lcd.printf("int %.1f set %d",tinterno, temp); + lcd.locate(0,1); + lcd.printf("ext %.1f", texterno); + comp = tinterno; + if(comp == temp) + pc.printf("las temperaturas son iguales\n\r"); + else + pc.printf("temperaturas distintas\n\r"); + wait(1); + } +} \ No newline at end of file
diff -r 000000000000 -r 05e7963d2ae2 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Nov 28 12:20:53 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/165afa46840b \ No newline at end of file