Hideto KANOSHIMA
New member
Hello everybody. I'm writing a simple communication program with Teensy 4.0.
Please give me a hint as data reception from the terminal does not go well.
In the attached program, if I send characters over 62 bytes to Teensy4.0, it will no longer respond.
Where is my mistake?
Please give me a hint as data reception from the terminal does not go well.
In the attached program, if I send characters over 62 bytes to Teensy4.0, it will no longer respond.
Where is my mistake?
Code:
String hostString = "";
void setup() {
// put your setup code here, to run once:
Serial.begin(38400);
hostString = "";
}
void serialEvent() {
while (Serial.available()) {
char inChar = (char)Serial.read();
hostString += inChar;
}
}
void loop() {
// put your main code here, to run repeatedly:
if (hostString.length()){
Serial.print(hostString);
hostString = "";
}
}
Last edited by a moderator: