连电脑后,led闪绿灯后闪黄灯,摄像头拍的是白屏,芯片很烫是怎么回事。
-
-
运行的什么代码?
-
import sensor, image, time
from pid import PID
from pyb import Pin, Timer, UART
import timegnd = Pin('P0', Pin.OUT_PP)
ain1 = Pin('P1', Pin.OUT_PP)
bin1 = Pin('P2', Pin.OUT_PP)
slp = Pin('P3', Pin.OUT_PP)
gnd.low()
ain1.low()
bin1.low()
slp.high()
pwma = Pin('P7')
pwmb = Pin('P8')
tim = Timer(4, freq=1000)
ch1 = tim.channel(1, Timer.PWM, pin=pwma)
ch2 = tim.channel(2, Timer.PWM, pin=pwmb)
ch1.pulse_width_percent(0)
ch2.pulse_width_percent(0)30 -30
def run(left_speed, right_speed):if left_speed < 0: ain1.low() else: ain1.high() ch1.pulse_width_percent(abs(left_speed)) if right_speed < 0: bin1.high() else: bin1.low() ch2.pulse_width_percent(abs(right_speed))
def Uart_sevor(zu,t_s):
uart = UART(3, 9600, timeout_char=1000)
uart.init(9600, bits=8, parity=None, stop=1, timeout_char=1000)
TxBuf =bytearray([0x55,0x55,5,0x06,zu,0x01,0x00])
uart.write(TxBuf)
time.sleep(t_s*1000)sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(10)
sensor.set_auto_whitebal(False)
clock = time.clock()
green_threshold = (62, 99, 45, -28, 80, 33)
size_threshold = 5356
x_pid = PID(p=0.3, i=1, imax=100)
h_pid = PID(p=0.001, i=0.1, imax=30)
def find_max(blobs):
max_size=0
for blob in blobs:
if blob[2]*blob[3] > max_size:
max_blob=blob
max_size = blob[2]*blob[3]
return max_blob
Uart_sevor(0,1)
while(True):
clock.tick()
img = sensor.snapshot()
blobs = img.find_blobs([green_threshold])
if blobs:
max_blob = find_max(blobs)
x_error = max_blob[5]-img.width()/2
h_error = max_blob[2]*max_blob[3]-size_threshold
img.draw_rectangle(max_blob[0:4])
img.draw_cross(max_blob[5], max_blob[6])
x_output=x_pid.get_pid(x_error,1)
h_output=h_pid.get_pid(h_error,1)
a = ((-h_output-x_output))
b = ((-h_output+x_output))
print("a",a)
print("b",b)
if(-200 < h_error < 200):
run(0,0)
Uart_sevor(1,10)
break
run(a,b)
else:
run(30,-30)
-
请运行hello world ,如果没问题,就是你代码的问题。
-
hello world没问题,但是 img = sensor.snapshot()是一直白屏的,而且芯片很烫
-
Hello world 没问题,指的是可以正常显示图像吗?
-
显示不了图像,是白屏
-
请断开数据线,重新插入OpenMV ,运行下面的代码
-
-
你的OpenMV 可能坏了,联系售后检查维修。