Hello. I am beginner in Arduino and Nextion LCD.
I have Nextion Enhanced 3.5 inch LCD. When I press ON button on LCD it should send 0x65 0x00 0x01 0x01 0xff 0xff 0xff to the serial port & When I press OFF button on LCD it should send 0x65 0x00 0x02 0x01 0xff 0xff 0xff to the serial port. According to the datasheet the serial data format is HEX but when I checked it with PC serial monitor it was sending in ASCII. I want to switch ON and OFF an LED but how to do? If I send the same HEX data from PC serial monitor to Arduino its working fine but from Nextion its not working because of different format.
Why it is sending in ASCII? In simulator it is also showing in HEX but practically it is not in HEX. Why? Now what I have to do?
hex is only another representation for the same ... "A", dec(65), hex(41), bin(1000001), oct(101) .... that's all the same ...
It is sending 8 bits 01100101 as binary
- can be interpreted as 101 in decimal
- can be interpreted as 0x65 in hexadecimal
- can be interpreted as 145 in octal
- can be interpreted as e in ASCII
select to view in hex, it can be shown as hex
select to view in ASCII it can be shown in ascii
Hex is used primarily so that you can see values
- whereas in ASCII, 0xFF (decimal 255) does not exist
- in ASCII values 0x00 to 0x1F are generally not viewable
- in iso-8859-1 0xFF will appear as ÿ
- etc etc
So rather than all of what it could be
Hex is used for programming so value is known and unambiguous.