bool zeromsg_Printed = false;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int incomming_Msg_size;
if (Serial.available() > 0)
{
delay(20); // Wait 20ms for the rest of the characters to arrive
incomming_Msg_size = Serial.available();
Serial.print("incomming_Msg_size : ");
Serial.println(incomming_Msg_size);
while(Serial.available() > 0){ // to delete incomming data
Serial.read(); // to delete incomming data
zeromsg_Printed = false;
}
}
else {
incomming_Msg_size = Serial.available();
if (!zeromsg_Printed)
{
Serial.print("No incomming_Msg_size : ");
Serial.println(incomming_Msg_size);
zeromsg_Printed = true;
}
}
}