ADC values read in two formats are printed on PC terminal.
Dependencies: mbed
Diff: simple_AD_serial.cpp
- Revision:
- 0:0d95cd35c02a
- Child:
- 1:9178a2aee69f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/simple_AD_serial.cpp Thu May 10 02:25:35 2018 +0000 @@ -0,0 +1,15 @@ +#include "mbed.h" +Serial pc(USBTX, USBRX); +AnalogIn adin(p20); + +main() +{ float adval; + int iadval; + pc.printf("simple AD\n\r"); + while (1) { + adval=adin; + iadval=adin.read_u16(); + pc.printf("AD= %d %f\n\r", iadval, adval); + wait(0.5); } + } + \ No newline at end of file