Josip Novosel
/
mbed_proba4
vježba
main.cpp@0:6c5ab92f9d12, 2016-11-03 (annotated)
- Committer:
- jnovosel
- Date:
- Thu Nov 03 18:29:23 2016 +0000
- Revision:
- 0:6c5ab92f9d12
VT1_novosel
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jnovosel | 0:6c5ab92f9d12 | 1 | //Reads input through the ADC, and transfers to PC terminal |
jnovosel | 0:6c5ab92f9d12 | 2 | #include "mbed.h" |
jnovosel | 0:6c5ab92f9d12 | 3 | Serial pc(USBTX, USBRX); |
jnovosel | 0:6c5ab92f9d12 | 4 | AnalogIn Ain(p20); |
jnovosel | 0:6c5ab92f9d12 | 5 | float ADCdata; |
jnovosel | 0:6c5ab92f9d12 | 6 | int main() |
jnovosel | 0:6c5ab92f9d12 | 7 | { |
jnovosel | 0:6c5ab92f9d12 | 8 | pc.printf("ADC Data Values... \n\r"); |
jnovosel | 0:6c5ab92f9d12 | 9 | while (1) { |
jnovosel | 0:6c5ab92f9d12 | 10 | ADCdata=Ain*3.3; |
jnovosel | 0:6c5ab92f9d12 | 11 | pc.printf("Ulazni napon = %.2f V\n\r",ADCdata); |
jnovosel | 0:6c5ab92f9d12 | 12 | wait (0.5); |
jnovosel | 0:6c5ab92f9d12 | 13 | } |
jnovosel | 0:6c5ab92f9d12 | 14 | } |