Gustavo Ramirez
/
lecturaAnaloga
describe una lectura analogica basica
main.cpp@2:7d8925e51f85, 2015-09-28 (annotated)
- Committer:
- tony63
- Date:
- Mon Sep 28 22:26:22 2015 +0000
- Revision:
- 2:7d8925e51f85
- Parent:
- 1:d4b9822b8df4
programa que lee analogo y envia al pc por serial
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tony63 | 0:fd817c22d584 | 1 | // ejemplo lectura analoga |
tony63 | 0:fd817c22d584 | 2 | // EJEMPLO CON UN LCD PARA EL MODULO FRDM-KL25Z PARA LECTURA ANALOGA |
tony63 | 2:7d8925e51f85 | 3 | //y enviar al pc por puerto serial |
tony63 | 0:fd817c22d584 | 4 | |
tony63 | 0:fd817c22d584 | 5 | #include "mbed.h" |
tony63 | 0:fd817c22d584 | 6 | #include "TextLCD.h" |
tony63 | 2:7d8925e51f85 | 7 | Serial pc(USBTX,USBRX); //puertos del PC |
tony63 | 0:fd817c22d584 | 8 | AnalogIn Vin(PTC2); |
tony63 | 1:d4b9822b8df4 | 9 | TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5); // rs, e, d4-d7 |
tony63 | 0:fd817c22d584 | 10 | |
tony63 | 0:fd817c22d584 | 11 | int main( ){ |
tony63 | 0:fd817c22d584 | 12 | |
tony63 | 0:fd817c22d584 | 13 | lcd.cls(); |
tony63 | 2:7d8925e51f85 | 14 | wait(0.1); |
tony63 | 0:fd817c22d584 | 15 | while(1){ |
tony63 | 0:fd817c22d584 | 16 | lcd.cls(); |
tony63 | 2:7d8925e51f85 | 17 | lcd.printf("Volt(%f)", Vin.read()); |
tony63 | 2:7d8925e51f85 | 18 | pc.printf("%f\n", Vin.read()); |
tony63 | 2:7d8925e51f85 | 19 | wait(0.1); |
tony63 | 0:fd817c22d584 | 20 | } |
tony63 | 0:fd817c22d584 | 21 | } |