可是我把判断删掉以后舵机还是不动
O
oxsh
@oxsh
0
声望
2
楼层
349
资料浏览
0
粉丝
0
关注
oxsh 发布的帖子
-
利用二维识别控制舵机出现问题
我想利用payload识别为1时对舵机进行控制,但是运行的时候检测到二维码信息为1舵机不会动!
import sensor, image import time from pyb import Servo s2 = Servo(2) # P8 sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QQVGA) # can be QVGA on M7... sensor.skip_frames(30) sensor.set_auto_gain(False) # must turn this off to prevent image washout... while(True): img = sensor.snapshot() img.lens_corr(1.8) # strength of 1.8 is good for the 2.8mm lens. for code in img.find_qrcodes(): print(code.payload()) if code.payload() == 1: for i in range(-90,90): s2.angle(i)