Serial.write(0xff) outputs ⸮

Hi,

I’m trying to send data to a Nextion Display.
At the end of the data you need to send:

Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);

But somehow every time I do this, the only thing I see in the Serial monitor are 3 squares (⸮⸮⸮).

I havent really found anything related to this topic.

Thank you very much

Code.png

Arduino_UNO_Hardware_PWM_Schrittablauf.ino (11 KB)

What do you think that the Serial Monitor application, that expects ASCII data, should do when you send it binary data?

the only thing I see in the Serial monitor are 3 squares

Well, that is what I would expect (garbage out) when you supply garbage (in).

If the Serial port is being used to communicate with the Nextion display, you should not even be opening the Serial Monitor application.

@OP

1. Try, sending --

Serial.write(0x35);  //record what you see on the display
Serial.write(0xFF);           //record what is see on the display.

2. Find the corresponding characters for the operands/arguments of the codes of Step-1 from the following Table; you will be able to understand why is there garbage against the execution of the Serial.write(0xFF); instruction.

Oister:
I'm trying to send data to a Nextion Display.
At the end of the data you need to send:

Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);

But somehow every time I do this, the only thing I see in the Serial monitor are 3 squares (⸮⸮⸮).

Could it be that Serial Monitor is not a Nextion Display?

johnwasser:
Could it be that Serial Monitor is not a Nextion Display?

PaulS:
What do you think that the Serial Monitor application, that expects ASCII data, should do when you send it binary data?
Well, that is what I would expect (garbage out) when you supply garbage (in).

If the Serial port is being used to communicate with the Nextion display, you should not even be opening the Serial Monitor application.

I just opened the Serial monitor, because the Nextion Display I had wasn't working as expected, so I wanted to debug with the Serial monitor. But I wasn't aware that you can't send Binary Data to the Serial monitor.
But I fixed my problem now. The Nextion just didn't work, because I had other Print commands in my program which disturbed it.

But thank you guys for the Information about the Serial monitor not accepting Binary.

I wasn't aware that you can't send Binary Data to the Serial monitor.

Well, you CAN. It just might not be interpreted by the Serial monitor in the way some other Serial device interprets it.
I wonder if there is a "Nextion Emulator" that will run on a PC/etc for debugging...

One can always use an alternative terminal program that supports hex display of received data.

I use realterm (under Windows) but there are others.