esp8266-wiki icon indicating copy to clipboard operation
esp8266-wiki copied to clipboard

Serial.flush() have a problem.

Open jyzhkj opened this issue 9 years ago • 0 comments

void loop() { digitalWrite(12, 1); Serial.print("abcdffew"); Serial.flush(); digitalWrite(12, 0); delay(100); // wait for a second }

see the 12 pin when down, the last byte is not Send End.

so Change the HardwareSerial.cpp to:

void HardwareSerial::flush() { if(!_uart || !uart_tx_enabled(_uart)) { return; }

uart_wait_tx_empty(_uart);
long tt =uart_get_baudrate(_uart);
tt=12000000/tt;

delayMicroseconds(tt);

}

jyzhkj avatar Sep 04 '16 05:09 jyzhkj