Hi all,
I was using the code below to display four analog inputs on the computer through serial communication.The MCU that I am using is the LPC1768.
From the plots I noticed that the MBED code is slow since I was getting a very low quality graph.
After I commented the serial command line pc.printf("%f,%f,%f,%f,%f\n", ADC1_voltage, ADC2_voltage, ADC3_voltage, ADC4_voltage); I noticed that the code functioned correctly.
Can someone please guide me on what I am doing wrong?
Moderators note: used code tags for C
I was using the code below to display four analog inputs on the computer through serial communication.The MCU that I am using is the LPC1768.
From the plots I noticed that the MBED code is slow since I was getting a very low quality graph.
After I commented the serial command line pc.printf("%f,%f,%f,%f,%f\n", ADC1_voltage, ADC2_voltage, ADC3_voltage, ADC4_voltage); I noticed that the code functioned correctly.
Can someone please guide me on what I am doing wrong?
C:
#include "mbed.h"
// Initialize a pins to perform analogue input fucntions
AnalogIn ain1(p15);
AnalogIn ain2(p16);
AnalogIn ain3(p17);
AnalogIn ain4(p19);
// USB serial (TX, RX)
Serial pc(USBTX, USBRX);
int main(void)
{
// Declaring variables to be used for the ADC voltages
float ADC1_voltage;
float ADC2_voltage;
float ADC3_voltage;
float ADC4_voltage;
while (1)
{
ADC1_voltage = ain1*3.3;
ADC2_voltage = ain2*3.3;
ADC3_voltage = ain3*3.3;
ADC4_voltage = ain4*3.3;
// Send the five ADC values to serial port
pc.printf("%f,%f,%f,%f\n", ADC1_voltage, ADC2_voltage, ADC3_voltage, ADC4_voltage);
}
}
Last edited by a moderator: