@@ -75,7 +75,7 @@ def catch_escape_key(indev, indev_data):
7575# so it needs a software power off to prevent it from staying hot all the time and quickly draining the battery.
7676# 1) Initialize camera, otherwise it doesn't reply to I2C commands:
7777try :
78- from camera import Camera , GrabMode , PixelFormat , FrameSize , GainCeiling
78+ from camera import Camera
7979cam = Camera (data_pins = [12 ,13 ,15 ,11 ,14 ,10 ,7 ,2 ],vsync_pin = 6 ,href_pin = 4 ,sda_pin = 21 ,scl_pin = 16 ,pclk_pin = 9 ,xclk_pin = 8 ,xclk_freq = 20000000 ,powerdown_pin = - 1 ,reset_pin = - 1 ,pixel_format = PixelFormat .RGB565 ,frame_size = FrameSize .R240X240 ,grab_mode = GrabMode .LATEST )
8080cam .deinit ()
8181except Exception as e :
@@ -84,8 +84,9 @@ def catch_escape_key(indev, indev_data):
8484try :
8585from machine import Pin ,I2C
8686i2c = I2C (1 ,scl = Pin (16 ),sda = Pin (21 ))# Adjust pins and frequency
87- #devices = i2c.scan()
88- #print([hex(addr) for addr in devices]) # finds it on 60 = 0x3C after init
87+ devices = i2c .scan ()
88+ print ("Scan of I2C bus on scl=16, sda=21:" )
89+ print ([hex (addr )for addr in devices ])# finds it on 60 = 0x3C after init
8990camera_addr = 0x3C # for OV5640
9091reg_addr = 0x3008
9192reg_high = (reg_addr >> 8 )& 0xFF # 0x30