ADC values read in two formats are printed on PC terminal.

Dependencies:   mbed

simple_AD_serial.cpp

Committer:
titanium
Date:
2018-05-10
Revision:
0:0d95cd35c02a
Child:
1:9178a2aee69f

File content as of revision 0:0d95cd35c02a:

#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); }
   }