Hi,
Just getting started with an OpeMV PT, without a Lepton attached (I don’t have one).
I’ve modified the main.py found in the 34MB drive which appears after plugging in and powering on the board to get rid of anything related to the Lepton.
The code runs (from the IDE, not as a standalone main.py) but the image on the LCD flickers with superimposition of the main image on itself (the 2nd image is the ghost), shifted at random values along the width of the display (the “ghost” image jumps around):
My code:
import sensor, image, time, lcd, math, pyb
from machine import I2C
from vl53l1x import VL53L1X
# Color Tracking Thresholds (Grayscale Min, Grayscale Max)
threshold_list = [(200, 255)]
def main():
i2c = I2C(2)
distance = VL53L1X(i2c)
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.VGA)
time.sleep_ms(50)
lcd.init(lcd.LCD_DISPLAY, framesize=lcd.FWVGA, refresh=30)
#lcd.init(lcd.LCD_DISPLAY_WITH_HDMI, framesize=lcd.FWVGA, refresh=60)
#lcd.init(lcd.LCD_DISPLAY_WITH_HDMI, framesize=lcd.VGA, refresh=60)
alpha_pal = image.Image(256, 1, sensor.GRAYSCALE)
for i in range(256): alpha_pal[i] = int(math.pow((i / 255), 2) * 255)
while True:
img = sensor.snapshot()
img.draw_string(4, 54, 'Distance: %d mm' % distance.read(), color = (255, 255, 255), mono_space = False, scale = 2)
lcd.display(img, x_size = lcd.width(),y_size = lcd.height(), hint = image.BILINEAR)
#lcd.display(img, hint = image.BILINEAR)
try:
main()
except OSError:
# I2C Bus may be stuck
p = pyb.Pin('P4', pyb.Pin.OUT_OD)
for i in range(20000):
p.value(not p.value())
pyb.hard_reset()
Why is it so?
Ludo