Hi, I need help to increase speed up send Serial Data using Serial.print
for(int i = 1; i<=200; i++){
//timer = micros();
val1 = (float)analogRead(analogPin1)* (3.3/4095);
val2 = (float)analogRead(analogPin2)* (3.3/4095);
val3 = (float)analogRead(analogPin3)* (3.3/4095);
val4 = (float)analogRead(analogPin4)* (3.3/4095);
//timerb = micros();
Serial.print(i);
//timerb = micros();
Serial.print(",");
Serial.print(val1,4);
Serial.print(",");
Serial.print(val2,4);
Serial.print(",");
Serial.print(val3,4);
Serial.print(",");
Serial.print(val4,4);
Serial.print(",");
}
thats the loop Im working with right now,
Im using a baudrate of 614400 successfully as processing is getting correct data (no higher baud rate i tested works), I just need the Serial.prints to be faster because right now that block of code takes about 580us.
I've seen solutions like this
char asdf[32];
snprintf(asdf,32,"%d, %d, %f, %f, %f, %f,",timer-timerb,i,val1,val2,val3,val4);
Serial.print(asdf);
but this actually takes longer.. Ive seen a modified HarwareSerial.cpp that I tried using on another post, didnt work.
Ive seen some stuff on using the native programmer port? I dont know whats the difference
Anybody got some clever solution??
Thanks in advance