0

I have an RPi3 with a Nextion HMI 2.8" display connected through the FT232 converter and I am testing the possibility of reading from it. I would like to call a certain function after pressing a button on the screen. I managed to do it, but there was a lot of delay - I have to hold the button for more than 1 second to receive result on RPi. Do you have any idea how to improve it? On Arduino I use Nextion.h library and I don't have such problem.

import binascii

ser = serial.Serial('/dev/ttyUSB1', 9600)

while True:
    if ser.in_waiting > 0:
        data = ser.read(ser.in_waiting)
        hex_data = binascii.hexlify(data).decode('utf-8')
        if hex_data == '65010200ffffff':
            print("Button 1")
        elif hex_data == '65010300ffffff':
            print("Button 2")
        elif hex_data == '65010400ffffff':
            print("Button 3")```

Michal Grzelak
  • 191
  • 5
  • 15
  • Welcome to Stack Overflow. This is an [English-only](https://stackoverflow.com/help/non-english-questions) site. Please translate your question to English. – MattDMo May 15 '23 at 19:38
  • So sorry, it was very late when posting question. Didn't notice it :) – Michal Grzelak May 16 '23 at 10:11

0 Answers0