logo

这个语法没错误啊!!!!!!!!!

2019-07-07 18:57
K
wfb3
9ab43c96-63b5-4dfe-9841-d6fb9b3959b9.png
K
wfb3

@wfb3 pin9为输入口

K
wfb3

@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() #红灯代表正在传数据

2019-07-07 19:10
K
wfb3

@wfb3 有人吗?急急急!!!!!

2019-07-08 13:38
I
网红小智智 星瞳科技

1,不应该有空行,

2,if后面不能有两个空格,

3,最后一行的缩进不对。