为啥起始定义的是低电平,但连接IDE时,未运行代码时输出的是高电平?
-
起始定义的是低电平,如下:
p_out = Pin('P3', Pin.OUT_PP)
p_out.low()
在运行代码时,可以按照指令输出高电平或低电平,但是当我的电脑和Openmv Cam相连时,也就是仅仅进行连接,但没有点击IDE左下角的三角形运行时,Openmv Cam持续输出高电平。import sensor, time, image from pid import PID from pyb import Servo from pyb import Pin pan_servo=Servo(1) tilt_servo=Servo(2) pan_pid = PID(p=0.15, i=0, imax=90) tilt_pid = PID(p=0.15, i=0, imax=90) sensor.reset() sensor.set_contrast(3) sensor.set_gainceiling(16) sensor.set_framesize(sensor.VGA) sensor.set_windowing((320, 240)) sensor.set_pixformat(sensor.GRAYSCALE) sensor.skip_frames(time = 2000) sensor.set_auto_gain(False, value=100) p_out = Pin('P3', Pin.OUT_PP) p_out.low() def draw_keypoints(img, kpts): if kpts: print(kpts) img.draw_keypoints(kpts) img = sensor.snapshot() time.sleep(1000) kpts1 = image.load_descriptor("/Unrecyclable.orb") img = sensor.snapshot() clock = time.clock() while (True): clock.tick() img = sensor.snapshot() kptsA = img.find_keypoints(max_keypoints=150, threshold=10, normalized=True) if (kptsA): match1 = image.match_descriptor(kpts1, kptsA, threshold=85) if (match1.count()>10): p_out.high() else : p_out.low() print(kptsA, "matched:%d dt:%d"%(match1.count(), match1.theta())) img.draw_string(0, 0, "FPS:%.2f"%(clock.fps()))
-
IDE连接到OpenMV电路板的时候,会终止电路板上运行的程序。IO引脚会失效,我记得应该是悬浮。
这是正常的。