05-04 LoggingData
From Manuals
(Difference between revisions)
Support (Talk | contribs)
(Created page with 'This example reads an analog voltage and transfers the reading to a terminal running on a personal computer. /*Program Example 5.4: Reads input voltage through the ADC, and tr…')
Newer edit →
(Created page with 'This example reads an analog voltage and transfers the reading to a terminal running on a personal computer. /*Program Example 5.4: Reads input voltage through the ADC, and tr…')
Newer edit →
Revision as of 15:30, 14 August 2014
This example reads an analog voltage and transfers the reading to a terminal running on a personal computer.
/*Program Example 5.4: 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(A0);
float ADCdata;
int main() {
pc.printf("ADC Data Values...\n\r"); //send an opening text message
while(1) {
ADCdata=Ain;
wait(0.5);
pc.printf("%1.3f \n\r",ADCdata); //send the data to the terminal
}
}


