logo

使用LCD屏幕不占用P1(串口Tx)引脚,为什么还是无法使用P1正常发送数据?

2025-07-25 10:28
Z
u1dm

import sensor, image, time
from pyb import UART
import display

sensor.reset()  # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565)  # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QQVGA2)  # Special 128x160 framesize for LCD Shield.

lcd = display.SPIDisplay()
uart = UART(1, 115200) # 矩形坐标通过UART1发送

while True:
    uart.write(b'a')
    lcd.write(sensor.snapshot())  # Take a picture and display the image.

用这段代码只能发送一次数据,如果把发送放在lcd.write(sensor.snapshot()) # Take a picture and display the image.这段代码后面,那么一次数据都发送不了

2025-07-25 17:55
Z
星小瞳xs

你是如何发现无法正常发送数据的?你的这段代码并不是只发送一次,而是在循环里面一直发送

2025-07-25 21:52
Z
u1dm

理论上就是一直发送呀,现在问题是就在正常发送的代码里加上lcd显示,本来应该一直发送的就只能发送一次了

2025-07-26 12:03
Z
u1dm

@uzbd 理论上就是一直发送呀,现在问题是就在正常发送的代码里加上lcd显示,本来应该一直发送的就只能发送一次了