Hi,
I have an application where i am sending data from a teensy 3.1 over serial via usb to software running on the pc.
The application has a variable on how often data is send.
When sending with less than 200Hz the output is streaming fine. When i go higher with the frequency the data is coming in as chunks.
Which is bad for the continuous plotting of my data inside the software.
Here is a sample code were you can test it. Just test with different values for hz.
I know that this must be some kind of buffer problem but on the teensy or on the software (windows) side?
I did test it with arduino console, visual studio and inside my software application, no differences.
I have an application where i am sending data from a teensy 3.1 over serial via usb to software running on the pc.
The application has a variable on how often data is send.
When sending with less than 200Hz the output is streaming fine. When i go higher with the frequency the data is coming in as chunks.
Which is bad for the continuous plotting of my data inside the software.
Here is a sample code were you can test it. Just test with different values for hz.
Code:
const byte COMMANDLENGTH = 2;
int hz = 250;
void setup()
{
// start serial port at 9600 bps and wait for port to open:
Serial.begin(9600);
}
void loop()
{
unsigned char sendcommand[COMMANDLENGTH];
for (int i=0; i < COMMANDLENGTH; i++){
sendcommand[i] = 0x41+i;
}
Serial.write(sendcommand,COMMANDLENGTH);
Serial.print(micros());
delay(1000/hz);
}
I know that this must be some kind of buffer problem but on the teensy or on the software (windows) side?
I did test it with arduino console, visual studio and inside my software application, no differences.