为什么我的openmv插上tof模块运行例程可以植入时提示没有文件或者无权限
-
-
@ovts 就例程时候没问题,但是想植入到别的程序时就不行
-
如果涉及代码,需要报错提示与全部代码文本,请注意不要贴代码图片
-
@kidswong999 
请在这里粘贴代码
enable_lens_corr = False # turn on for straighter lines...打开以获得更直的线条…
import sensor, image, time,pyb, math
from pyb import UART
import json
from machine import I2C
from vl53l1x import VL53L1Xi2c = I2C(2)
distance = VL53L1X(i2c)sensor.reset()
sensor.set_pixformat(sensor.RGB565) # 灰度更快(160x120 max on GRAYSCALE OpenMV-M7 )
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()
uart = UART(3, 9600)
uart.init(9600, bits=8, parity=None, stop=1) # 使用给定参数初始化def max_blob(b):
max_pixel=0
for blb in b:
if (blb.magnitude()>max_pixel):
max_pixel=blb.magnitude()
max_blb=blb
return blbwhile(True):
clock.tick()
img = sensor.snapshot()
area1=(45,23,55,50)
x1=x2=x3=x4=y1=y2=y3=y4=0
z1=z2=z3=z4=[0,0]
r=img.find_rects(roi=area1,threshold = 18000)
c=img.find_circles(roi=area1,threshold = 3000, x_margin = 10, y_margin = 10, r_margin = 10,r_min = 2, r_max = 100, r_step = 2)
a=bytearray([0x0a,0,x1,x2,x3,x4,0,0,0,0,0x0d])
b=bytearray([0x0a,0,x1,x2,x3,x4,y1,y2,y3,y4,0x0d])
if(c):
c_max=max_blob(c)
img.draw_circle(c_max.x(),c_max.y(),c_max.r(), color = (255, 0, 0))
a=bytearray([0x0a,1,c_max.x(),c_max.y(), c_max.r(),0,0,0,0,0,0x0d])
uart.write(a)
#print(a)
print("range: mm ", distance.read())
time.sleep(50)
elif(r):
r_max=max_blob(r)
img.draw_rectangle(r_max.rect(), color = (255, 0, 0))
for p in r_max.corners(): img.draw_circle(p[0], p[1], 5, color = (0, 255, 0))#z1=list(r_max.corners[0]) z=list(r_max.corners()) z1=z[0] z2=z[1] z3=z[2] z4=z[3] z1=list(z1) z2=list(z2) z3=list(z3) z4=list(z4) b=bytearray([0x0a,2,z1[0],z2[0],z3[0],z4[0],z1[1],z2[1],z3[1],z4[1],0x0a]) uart.write(b) print(b)
-
那你可以手动把vl53l1x.py复制到OpenMV里。
文件是这个:https://github.com/openmv/openmv/blob/master/scripts/libraries/vl53l1x.py
-
@kidswong999 
-
@kidswong999 这又是为什么呢
-
@kidswong999 还有这个