When is UART.write finished?
Posted: Sat Sep 11, 2021 1:58 pm
I'm working with a max485 board on a Raspberry Pi Pico. I'm fairly new to python. Anyway I'm really wondering if there is any way to tell when the uart.write is finished? I've been searching all over and I'm not finding anything that I understand (one example redid the UART class but I didn't understand the code or how to implement it). The code below works but I'd need a longer delay for longer messages / lower baudrates and I'd like to avoid using sleep is possible.
Thanks
Thanks
Code: Select all
from machine import Pin, UART
import time
uart = UART(0,115200,tx=Pin(0),rx=Pin(1))
txpin = Pin(3,Pin.OUT)
txpin.value(1)
writeme = "Testing 1 2 3\r\n"
writeme = writeme.encode()
writeme = bytearray(writeme)
uart.write(writeme)
time.sleep(0.002)
txpin.value(0)