mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
scripts/examples: Cleanup LCD shield example.
This commit is contained in:
parent
cc9e9c94f4
commit
a5ac15a764
@ -1,26 +0,0 @@
|
||||
# This work is licensed under the MIT license.
|
||||
# Copyright (c) 2013-2023 OpenMV LLC. All rights reserved.
|
||||
# https://github.com/openmv/openmv/blob/master/LICENSE
|
||||
#
|
||||
# LCD Example
|
||||
#
|
||||
# Note: To run this example you will need a LCD Shield for your OpenMV Cam.
|
||||
#
|
||||
# The LCD Shield allows you to view your OpenMV Cam's frame buffer on the go.
|
||||
|
||||
import sensor
|
||||
import display
|
||||
|
||||
sensor.reset() # Initialize the camera sensor.
|
||||
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE
|
||||
sensor.set_framesize(sensor.QQVGA2) # Special 128x160 framesize for LCD Shield.
|
||||
# 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.
|
||||
lcd = display.SPIDisplay()
|
||||
|
||||
while True:
|
||||
lcd.write(sensor.snapshot()) # Take a picture and display the image.
|
@ -0,0 +1,35 @@
|
||||
# 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
|
||||
#
|
||||
# LCD Shield Example
|
||||
#
|
||||
# Note: To run this example you will need a LCD Shield for your OpenMV Cam.
|
||||
#
|
||||
# The 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.LCD)
|
||||
|
||||
# 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(vflip=True, hmirror=True)
|
||||
clock = time.clock()
|
||||
|
||||
while True:
|
||||
clock.tick()
|
||||
lcd.write(sensor.snapshot(), hint=image.CENTER | image.SCALE_ASPECT_KEEP)
|
||||
print(clock.fps())
|
Loading…
Reference in New Issue
Block a user