Clearing serial buffer solved

void serialFlush(){

  • while(Serial.available() > 0) { //while there are characters in the serial buffer, because Serial.available is >0*
  • char t = Serial.read(); // get one character*
  • }*
    *} *