I am new to serial connections, so there may be an obvious answer to this ...
I am recording data from six analog inputs to the Arduino over a serial port to MakerPlot. They plot well, but the timing is distorted ... it pauses every so often (maybe every second or so?), making a wildly distorted graph.
My data have a cycle of around 120 cycles per minute (500 ms per cycle), so I need pretty consistent readings to get a smooth curve.
I don't know these pauses are a characteristic of serial ports, of Arduino, or of MakerPlot. However, when using the built-in Arduino serial monitor, it doesn't seem to do this.
Would appreciate suggestions as to the best way to get a reliable stream of data from the Arduino, hopefully at a consistent sampling interval of around 10ms.
(I have a data-logging shield (using an SD card), but haven't put it together yet, as real-time logging and display are better, if they don't screw up the data ...)
void readpins() {
float V0=analogRead(A0)*5/1024.0;
float V1=analogRead(A1)*5/1024.0;
float V2=analogRead(A2)*5/1024.0;
float V3=analogRead(A3)*5/1024.0;
float V4=analogRead(A4)*5/1024.0;
float V5=analogRead(A5)*5/1024.0;
}
void testprint(){
Serial.print(V0);
Serial.print(",");
Serial.print(V1);
Serial.print(",");
Serial.print(V2);
Serial.print(",");
Serial.print(V3);
Serial.print(",");
Serial.print(V4);
Serial.print(",");
Serial.println(V5);
}
Thanks!
Phil