para probar la salida análoga con la lectura del conversor A/D cada 25%
ESTE MONTAJE REQUIERE ESTE PUENTE
main.cpp@0:6943999d9a48, 2017-03-14 (annotated)
- Committer:
- tony63
- Date:
- Tue Mar 14 23:38:50 2017 +0000
- Revision:
- 0:6943999d9a48
para probar la salida an?loga con la lectura del conversor A/D cada 25%
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tony63 | 0:6943999d9a48 | 1 | #include "mbed.h" |
tony63 | 0:6943999d9a48 | 2 | Serial pc(USBTX, USBRX); |
tony63 | 0:6943999d9a48 | 3 | AnalogIn input(PTB0); |
tony63 | 0:6943999d9a48 | 4 | AnalogOut VOUT(PTE30); |
tony63 | 0:6943999d9a48 | 5 | int main() { |
tony63 | 0:6943999d9a48 | 6 | float volt; |
tony63 | 0:6943999d9a48 | 7 | |
tony63 | 0:6943999d9a48 | 8 | while(1){ |
tony63 | 0:6943999d9a48 | 9 | wait(1); |
tony63 | 0:6943999d9a48 | 10 | VOUT=0.25; |
tony63 | 0:6943999d9a48 | 11 | volt=input*1000; |
tony63 | 0:6943999d9a48 | 12 | pc.printf("Voltaje: %f\n", volt); |
tony63 | 0:6943999d9a48 | 13 | |
tony63 | 0:6943999d9a48 | 14 | wait(1); |
tony63 | 0:6943999d9a48 | 15 | VOUT=0.5; |
tony63 | 0:6943999d9a48 | 16 | volt=input*1000; |
tony63 | 0:6943999d9a48 | 17 | pc.printf("Voltaje: %f\n", volt); |
tony63 | 0:6943999d9a48 | 18 | |
tony63 | 0:6943999d9a48 | 19 | |
tony63 | 0:6943999d9a48 | 20 | wait(1); |
tony63 | 0:6943999d9a48 | 21 | VOUT=0.75; |
tony63 | 0:6943999d9a48 | 22 | volt=input*1000; |
tony63 | 0:6943999d9a48 | 23 | pc.printf("Voltaje: %f\n", volt); |
tony63 | 0:6943999d9a48 | 24 | |
tony63 | 0:6943999d9a48 | 25 | wait(1); |
tony63 | 0:6943999d9a48 | 26 | VOUT=1.0; |
tony63 | 0:6943999d9a48 | 27 | volt=input*1000; |
tony63 | 0:6943999d9a48 | 28 | pc.printf("Voltaje: %f\n", volt); |
tony63 | 0:6943999d9a48 | 29 | } |
tony63 | 0:6943999d9a48 | 30 | } |
tony63 | 0:6943999d9a48 | 31 |