programa para probar el conversor A/D sobre el PC
MONTAJE REQUERIDO USAR UN POTENCIOMETRO Y CONECTAR 3.3V Y GND
main.cpp@0:130e0223a2d8, 2017-03-14 (annotated)
- Committer:
- tony63
- Date:
- Tue Mar 14 23:07:00 2017 +0000
- Revision:
- 0:130e0223a2d8
programa para probar el conversor A/D sobre el PC
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tony63 | 0:130e0223a2d8 | 1 | #include "mbed.h" |
tony63 | 0:130e0223a2d8 | 2 | Serial pc(USBTX, USBRX); |
tony63 | 0:130e0223a2d8 | 3 | AnalogIn input(PTB0); |
tony63 | 0:130e0223a2d8 | 4 | |
tony63 | 0:130e0223a2d8 | 5 | int main() { |
tony63 | 0:130e0223a2d8 | 6 | float volt; |
tony63 | 0:130e0223a2d8 | 7 | while(1){ |
tony63 | 0:130e0223a2d8 | 8 | wait(0.1); |
tony63 | 0:130e0223a2d8 | 9 | volt=input*1000; |
tony63 | 0:130e0223a2d8 | 10 | pc.printf("Voltaje: %f\n", volt); |
tony63 | 0:130e0223a2d8 | 11 | } |
tony63 | 0:130e0223a2d8 | 12 | |
tony63 | 0:130e0223a2d8 | 13 | } |