Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- Kit1
- Date:
- 2013-09-01
- Revision:
- 0:06ea14e458e3
- Child:
- 1:71b75f1d31ca
File content as of revision 0:06ea14e458e3:
/*Program 5: 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); Timer t; float ADCdata; int main() { pc.printf("ADC Data Values…\n\r"); //send an opening text message while(1){ t.start(); for (int i=0;i<=9;i++) { ADCdata=ADCdata+Ain*3.3; //sum 10 samples } ADCdata=ADCdata/10; //divide by 10 wait(0.5); pc.printf("%1.3f \n\r",ADCdata); //send the data to the terminal t.stop(); printf("The time taken was %f seconds\n", t.read()); } }