ravi butani
/
EXP12_ADC_UART
EXP12
Revision 0:bf343980193f, committed 2016-04-21
- Comitter:
- rx5
- Date:
- Thu Apr 21 04:50:12 2016 +0000
- Commit message:
- EXP12
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Apr 21 04:50:12 2016 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" +Serial pc(USBTX, USBRX); // Initlize UART on USB port of KL25Z with default Baud 9600 +AnalogIn ain(PTC2); +int main() +{ + float adc_value=0; + // pc.baud(115200); // uncomment this line and update baudrate to cahnge baud rate from 9600 default + pc.printf("\r\n"); // print startup message from new line on UART Terminal + pc.printf("Experiment - 12\r\n"); // print startup message on UART Terminal + pc.printf("ADC reading on UART Interface\r\n"); // print startup message on UART Terminal + wait(3.0); // wait 3 second to show startup message + while(1) // loop forever + { + adc_value = ain; + pc.printf("ADC Reading in %% = %0.2f %% \t ADC Reading in mV = %0.2f mV\r\n",adc_value*100.0,adc_value*3300.0); // print ADC value in % and mV on UART Terminal + wait(1.0); // Wait for 1 second + } + +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Apr 21 04:50:12 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f \ No newline at end of file