
@wfb3 pin9为输入口
@wfb3
import sensor, image #导入需要使用的模块
from pyb import Pin #引入pin脚
from pyb import LED #引入自带LED
green_led = LED(2)
red_led = LED(1)
pin9 = Pin('P9', Pin.IN, Pin.PULL_UP) #p9输入信号
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
while(True):
img = sensor.snapshot().lens_corr(1.8)
for c in img.find_circles(threshold = 2000, x_margin = 10, y_margin = 10, r_margin = 10):
# img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0)) #画圆
#以下为接收到pin9信号
if pin9.value(): #如果pin9为1,进入数据传输
red_led.on() #红灯代表正在传数据
@wfb3 有人吗?急急急!!!!!
1,不应该有空行,
2,if后面不能有两个空格,
3,最后一行的缩进不对。