esp8266-wiki
esp8266-wiki copied to clipboard
Serial.flush() have a problem.
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);
}