Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5375

MicroPython • Re: How to Read Data from Nextion Display via UART with Pico

$
0
0
SOLVED

When I do this, I can control the values on the Nextion screen with Pico.

Code:

import machineimport timeRX_PIN = machine.Pin(5)TX_PIN = machine.Pin(4)nextion_uart = machine.UART(1, baudrate=9600, rx=RX_PIN, tx=TX_PIN)end_cmd=b'\xFF\xFF\xFF'def sendNextion(value):    sliderVal=int(1.6 * value + 17)    nextion_uart.write("numara.val="+str(sliderVal))    nextion_uart.write(end_cmd)    time.sleep_ms(100)    tempVal = a    nextion_uart.write("azalt.txt="+str(tempVal))    nextion_uart.write(b'\xFF\xFF\xFF')    time.sleep_ms(100)    temperature = 5sendNextion(temperature)while True:    temperature = 5    sendNextion(temperature)

Statistics: Posted by rdvncrt — Fri Feb 09, 2024 8:52 am



Viewing all articles
Browse latest Browse all 5375

Trending Articles