From 7602c8638b519c310cfe1f6508581631d6968699 Mon Sep 17 00:00:00 2001 From: "Kwabena W. Agyeman" Date: Sun, 6 Jul 2025 18:26:24 -0700 Subject: [PATCH] scripts/examples: Add 320x240 basic touch LCD example. --- .../69-Touch-LCD-Shield/touch_lcd_shield.py | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 scripts/examples/50-OpenMV-Boards/60-Shields/69-Touch-LCD-Shield/touch_lcd_shield.py diff --git a/scripts/examples/50-OpenMV-Boards/60-Shields/69-Touch-LCD-Shield/touch_lcd_shield.py b/scripts/examples/50-OpenMV-Boards/60-Shields/69-Touch-LCD-Shield/touch_lcd_shield.py new file mode 100644 index 000000000..3c3743322 --- /dev/null +++ b/scripts/examples/50-OpenMV-Boards/60-Shields/69-Touch-LCD-Shield/touch_lcd_shield.py @@ -0,0 +1,39 @@ +# This work is licensed under the MIT license. +# Copyright (c) 2013-2025 OpenMV LLC. All rights reserved. +# https://github.com/openmv/openmv/blob/master/LICENSE +# +# Touch LCD Shield Example +# +# Note: To run this example you will need a Touch LCD Shield for your OpenMV Cam. +# +# The touch LCD shield allows you to view your OpenMV Cam's frame buffer on the go. + +import sensor +import time +import display +import image + +sensor.reset() +sensor.set_pixformat(sensor.RGB565) +sensor.set_framesize(sensor.QVGA) + +# Initialize the lcd screen. +# Note: A DAC or a PWM backlight controller can be used to control the +# backlight intensity if supported: +# lcd = display.SPIDisplay(backlight=display.DACBacklight(channel=2)) +# lcd.backlight(25) # 25% intensity +# Otherwise the default GPIO (on/off) controller is used. +# 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(width=320, + height=240, + bgr=True, + vflip=False, + hmirror=False) +clock = time.clock() + +while True: + clock.tick() + lcd.write(sensor.snapshot(), hint=image.CENTER | image.SCALE_ASPECT_KEEP) + print(clock.fps())