![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
vježba 3a
Diff: main.cpp
- Revision:
- 0:1d1430d5fd6b
diff -r 000000000000 -r 1d1430d5fd6b main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Nov 26 17:44:47 2013 +0000 @@ -0,0 +1,16 @@ +/*Program Example 5.4: Reads input voltage through the ADC, and transfers to PC terminal + */ +#include "mbed.h" +Serial pc(USBTX, USBRX); //enable serial port which links to USB +AnalogIn Ain(p20); + +float ADCdata; + +int main() { + pc.printf("ADC Data Values...\n\r"); //send an opening text message + while(1){ + ADCdata=Ain; + wait(0.5); + pc.printf("%1.3f \n\r",ADCdata); //send the data to the terminal + } +}