Example: 50-OpenMV-Boards/60-Shields/60-LCD-Shield/lcd_shield.py
# 本作品采用MIT许可证授权。
# Copyright (c) 2013-2025 OpenMV LLC. All rights reserved.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# LCD Shield Example
#
# 注意:要运行此示例,您需要为OpenMV Cam配备LCD Shield。
#
# The LCD shield allows you to view your OpenMV Cam's frame buffer on the go.
import csi
import time
import display
import image
csi0 = csi.CSI()
csi0.reset()
csi0.pixformat(csi.RGB565)
csi0.framesize((128, 160))
# Initialize the lcd screen.
# 注意:如果支持,可以使用DAC或PWM背光控制器来控制
# 背光强度:
# lcd = display.SPIDisplay(backlight=display.DACBacklight(channel=2))
# lcd.backlight(25) # 25% intensity
# 否则使用默认的GPIO(开/关)控制器。
# OpenMV Cam M4/M7/H7/H7 Plus -> DAC and GPIO Support
# OpenMV Cam RT1062 -> GPIO Support
# OpenMV Cam N6 -> PWM and GPIO Support
lcd = display.SPIDisplay(vflip=True, hmirror=True)
clock = time.clock()
while True:
clock.tick()
lcd.write(csi0.snapshot(), hint=image.CENTER | image.SCALE_ASPECT_KEEP)
print(clock.fps())