Reputation: 11
I am having trouble interfacing my Nextion display via Raspberry Pi. I have a Nextion project that contains one text field called t0. And I want to change the text displayed from Raspberry.
Here is what I tried:
import serial
import time
import struct
ser = serial.Serial(
port='/dev/ttyUSB0',
baudrate =9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1)
k=struct.pack('B', 0xff)
time.sleep(1)
command = 't0.txt=\"hello\"'
ser.write(command.encode())
ser.write(k)
ser.write(k)
ser.write(k)
I am certain that connections are OK hence it is not hardware related. Thank you for support.
Upvotes: 0
Views: 392
Reputation: 11
Instead of this:
command = 't0.txt=\"hello\"'
I changed the command line to this:
command = 't0.txt="hello"'
Works for me good luck.
Upvotes: 0