没有报错,就是蜂鸣器一直闷响
U
u2gf
@u2gf
0
Reputation
6
Posts
111
Profile views
0
Followers
0
Following
Posts made by u2gf
-
RE: 无论是高电平 还是低电平 蜂鸣器一直闷响
import sensor, image, time, math, lcd from pyb import UART #串口 from pyb import Pin import json import machine threshold_index = 3 # threshold_index的数值对应了列表thresholds[]中的色块LAB thresholds = [(19, 100, -68, -6, -35, -5), #深蓝色 (17, 100, -50, -1, -27, -2),#浅蓝色 (92, 62, -6, 38, 38, -13), #粉色 (30, 66, -2, -32, -29, -11)] #白色 buzzer = Pin('P0', Pin.OUT_PP) buzzer.low() sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QQVGA2) sensor.skip_frames(time = 2000) sensor.set_auto_gain(False) # 关闭白平衡 sensor.set_auto_whitebal(False) # 关闭自动增益 clock = time.clock() lcd.init() #初始化LCD uart = UART(3, 115200) #初始化串口 uart.init(115200, bits=8, parity=None, stop=1) #8位数据位,无校验位,1位停止位、 while(True): clock.tick() img = sensor.snapshot() blob = img.find_blobs([thresholds[threshold_index]], area_threshold=300) text = 2; if blob: #如果找到了目标颜色 text = 1 if text == 1: print("MASK YES") uart.write("MASK YES") buzzer.low() for b in blob: #迭代找到的目标颜色区域 img.draw_rectangle(b[0:4]) # rect img.draw_cross(b[5], b[6]) # cx, cy img.draw_string(35, 70, "MASK!!") if text == 2:#如果没有找到口罩 print("ON MASK") uart.write("ON MASK") img.draw_string(35, 70, "NO MASK!!") buzzer.high() # 蜂鸣器响 #time.sleep(200) # 延时200毫秒 #buzzer.low() # 停止蜂鸣器 lcd.display(img)
-
LCD不能正常显示图像?
openMV与LCD连接上后,在openMV IDE上运行示例 lcd.py程序,可是LCD上显示的图像是一条一条的,LCD板子不是星瞳科技的,是TFT-LCD ST7735S型号的,想问一下是什么原因呀