Skip to content

Serial.flush() have a problem #2502

Closed
Closed
@jyzhkj

Description

@jyzhkj

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 I try to 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);
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions