Skip to content

Commit 74e4a74

Browse files
authored
feat(uart): uart break example improvement (#10525)
prints the HEXA and CHAR in order to allow the user to see why there is 1 extra char (0x00) when BREAK is received.
1 parent 07c510e commit 74e4a74

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libraries/ESP32/examples/Serial/OnReceiveError_BREAK_Demo/OnReceiveError_BREAK_Demo.ino

+5-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ void onReceiveFunction() {
8080
received_bytes = received_bytes + available;
8181
Serial.printf("onReceive Callback:: There are %d bytes available: {", available);
8282
while (available--) {
83-
Serial.print((char)Serial1.read());
83+
char c = Serial1.read();
84+
Serial.printf("0x%x='%c'", c, c);
85+
if (available) {
86+
Serial.print(" ");
87+
}
8488
}
8589
Serial.println("}");
8690
}

0 commit comments

Comments
 (0)