hello I'm having a lot of difficult to connect to serial port
I've a device that communicates by serial (Nextion HMI) with my raspberry pi via UART
I have this python file to read the port that works
serial_read.py
b'e\x06\x01\x00\xff\xff\xff'
this has a meaning (that i know)
the problem is that i want to do the opposite that is: write in the port the same command
so i've write this
serial_write.py
it seems that i'm not sending anything
what's wrong?
help is appreciated
I've a device that communicates by serial (Nextion HMI) with my raspberry pi via UART
I have this python file to read the port that works
serial_read.py
import serial ser = serial.Serial( port='/dev/ttyAMA0', baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=1 ) while 1: x = ser.readline() print(x)When i push a button in my tft screen i get
b'e\x06\x01\x00\xff\xff\xff'
this has a meaning (that i know)
the problem is that i want to do the opposite that is: write in the port the same command
so i've write this
serial_write.py
import time import serial ser = serial.Serial( port='/dev/ttyAMA0', baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=1 ) while 1: y='e\x06\x01\x00\xff\xff\xff' ser.write(y)but it does not work. I don't get anything when i run serial_read.py
it seems that i'm not sending anything
what's wrong?
help is appreciated