NITH ece
/
group3_transmiiter
transmitter code
Fork of SerialPC by
main.cpp
- Committer:
- Kit1
- Date:
- 2013-09-01
- Revision:
- 0:06ea14e458e3
- Child:
- 1:71d38917bdce
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()); } }