import sensor,time,image#引入感光元件的模块
from pyb import UART
from pyb import LED
from pyb import Pin
import pyb
# 设置摄像头
sensor.reset()#初始化感光元件
sensor.set_pixformat(sensor.RGB565)#设置为彩色
sensor.set_framesize(sensor.QVGA)#设置图像的大小
sensor.skip_frames()#跳过n张照片,在更改设置后,跳过一些帧,等待感光元件变稳定。
uart = UART(3, 115200)
led = LED(2)
img = sensor.snapshot()
#uart.write(img.compress())
while(1):
uart.write('1')
uart.write('\r\n')
print(1)
led.on()
time.sleep(150)
led.off()
time.sleep(100)
led.on()
time.sleep(150)
led.off()
time.sleep(600)尝试脱机运行成功,并且串口引脚连接也正常。
如果用USB转TTL链接电脑,使用该代码发送信息到电脑,可以用串口调试助手接收,请问openmv发送到STM32出了什么问题
检测是否接受串口用的是if(USART_RX_STA&0X8000)
那就是stm32接收端出得问题。、
1,可能线没接对。rx,tx反了,或者gnd没连。或者引脚不对。
2,可能stm32代码不对。
STM32接收端没有问题,因为我尝试STM32与电脑通信是正常的