I am trying to interface a Nextion 2.4" Display with Raspberry Pi 4. The Nextion display is connected to the RPi 4 as shown in the diagram below:
The test program that I want to run should display the I.P. address on the display. Using the pyserial library, I have written the following code:
Program to establish UART communication with Nextion display
from binascii import unhexlify
ser = serial.Serial ("/dev/ttyS0", 9600) #Open port with baud rate my_string='FF' ser.write("t0.txt=") ser.write("\"") ser.write("192.168.178.34") ser.write("\"") ser.write(unhexlify(my_string)) ser.write(unhexlify(my_string)) ser.write(unhexlify(my_string))
I have also sniffed the TX pin from the RPi 4 and the data is exactly as expected. The following terminal window shows the captured data:
Unfortunately, the I.P. address is not getting displayed on the Nextion Screen. I have also debugged the Display and it displays the data as expected:
Could anyone point to me where I messed up? Thanks!