Imprime en lcd la temperatura sensada por el CAS externo y el voltaje del CAS
Fork of LCD_test by
main.cpp@1:d7f3caab54a5, 2015-11-27 (annotated)
- Committer:
- josedaparte
- Date:
- Fri Nov 27 14:02:59 2015 +0000
- Revision:
- 1:d7f3caab54a5
- Parent:
- 0:a9f60dff8cb6
Imprime en lcd la temperatura sensada por el CAS externo y el voltaje del CAS
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
josedaparte | 0:a9f60dff8cb6 | 1 | #include "mbed.h" |
josedaparte | 0:a9f60dff8cb6 | 2 | #include "TextLCD.h" |
josedaparte | 0:a9f60dff8cb6 | 3 | #include "AnalogIn.h" |
josedaparte | 0:a9f60dff8cb6 | 4 | |
josedaparte | 1:d7f3caab54a5 | 5 | AnalogIn leer(PTC2); |
josedaparte | 0:a9f60dff8cb6 | 6 | |
josedaparte | 1:d7f3caab54a5 | 7 | TextLCD lcd(PTD3, PTA12, PTA4, PTA5, PTC8, PTC9, TextLCD::LCD16x2); |
josedaparte | 0:a9f60dff8cb6 | 8 | |
josedaparte | 0:a9f60dff8cb6 | 9 | int main() { |
josedaparte | 0:a9f60dff8cb6 | 10 | |
josedaparte | 1:d7f3caab54a5 | 11 | float temperatura; |
josedaparte | 1:d7f3caab54a5 | 12 | float voltajecas; |
josedaparte | 1:d7f3caab54a5 | 13 | uint16_t adcvalue; |
josedaparte | 0:a9f60dff8cb6 | 14 | |
josedaparte | 0:a9f60dff8cb6 | 15 | while(1){ |
josedaparte | 1:d7f3caab54a5 | 16 | lcd.cls(); |
josedaparte | 1:d7f3caab54a5 | 17 | adcvalue = leer.read_u16(); |
josedaparte | 1:d7f3caab54a5 | 18 | voltajecas = adcvalue*3.3/65525; |
josedaparte | 1:d7f3caab54a5 | 19 | lcd.printf("El Vcas es %.2f", voltajecas); |
josedaparte | 1:d7f3caab54a5 | 20 | temperatura = voltajecas * 100 / 5 + 0.04; |
josedaparte | 1:d7f3caab54a5 | 21 | lcd.locate(0,1); |
josedaparte | 1:d7f3caab54a5 | 22 | lcd.printf("Hace %.0f grados", temperatura); |
josedaparte | 1:d7f3caab54a5 | 23 | wait(1.5); |
josedaparte | 1:d7f3caab54a5 | 24 | |
josedaparte | 0:a9f60dff8cb6 | 25 | |
josedaparte | 0:a9f60dff8cb6 | 26 | |
josedaparte | 0:a9f60dff8cb6 | 27 | } |
josedaparte | 0:a9f60dff8cb6 | 28 | } |