scripts/examples: Reorganize OpenMV Board examples.

This commit is contained in:
Kwabena W. Agyeman 2024-01-24 21:18:38 -08:00
parent baa8a4ee58
commit e7ca0955f9
43 changed files with 83 additions and 1 deletions

View File

@ -0,0 +1,40 @@
# 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
#
# Deep Sleep Mode Example
# This example demonstrates the low-power deep sleep mode plus sensor shutdown.
# Note the camera will reset after wake-up from deep sleep. To find out if the cause of reset
# is deep sleep, call the machine.reset_cause() function and test for machine.DEEPSLEEP_RESET
import machine
import sensor
# Create and init RTC object.
rtc = machine.RTC()
# (year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])
rtc.datetime((2014, 5, 1, 4, 13, 0, 0, 0))
# Print RTC info.
print(rtc.datetime())
sensor.reset()
# Enable sensor softsleep
sensor.sleep(True)
# Optionally bypass the regulator on OV7725
# for the lowest possible power consumption.
if sensor.get_id() == sensor.OV7725:
# Bypass internal regulator
sensor.__write_reg(0x4F, 0x18)
# Shutdown the sensor (pulls PWDN high).
sensor.shutdown(True)
# Enable RTC interrupts every 30 seconds.
# Note the camera will RESET after wakeup from Deepsleep Mode.
rtc.wakeup(30000)
# Enter Deepsleep Mode.
machine.deepsleep()

View File

@ -0,0 +1,15 @@
# 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
#
# Sensor Sleep Mode Example.
# This example demonstrates the sensor sleep mode. The sleep mode saves around
# 40mA when enabled and it's automatically cleared when calling sensor reset().
import sensor
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time=3000) # Capture frames for 3000ms.
sensor.sleep(True) # Enable sensor sleep mode (saves about 40mA).

View File

@ -0,0 +1,24 @@
# 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
#
# Stop Mode Example
# This example demonstrates using the low-power Stop Mode.
import pyb
import machine
# Create and init RTC object.
rtc = pyb.RTC()
# (year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])
rtc.datetime((2014, 5, 1, 4, 13, 0, 0, 0))
# Print RTC info.
print(rtc.datetime())
# Enable RTC interrupts every 5 seconds.
rtc.wakeup(5000)
# Enter Stop Mode.
# Note the IDE will disconnect.
machine.sleep()

View File

@ -26,7 +26,10 @@
"examples/09-WiFi/(?!WINC1500).*$", "^(?!arduino_nano_33_ble_sense).*$", ".+", ""
"examples/09-WiFi/WINC1500", "(OPENMV2|OPENMV3|OPENMV4|OPENMV4P|OPENMVPT)", ".+", ""
"examples/10-Bluetooth", "(OPENMV_RT1060|ARDUINO_GIGA|ARDUINO_PORTENTA_H7|ARDUINO_NICLA_VISION|ARDUINO_NANO_RP2040_CONNECT)", ".+", ""
"examples/50-OpenMV-Boards/(?!main\.py).*$", "(OPENMV.*)", ".+", "OpenMV-Boards$"
"examples/50-OpenMV-Boards/50-STM32-Boards", "(OPENMV2|OPENMV3|OPENMV4|OPENMV4P|OPENMVPT)", ".+", "OpenMV-Boards(/50-STM32-Boards)?$"
"examples/50-OpenMV-Boards/50-IMXRT-Boards", "OPENMV_RT1060", ".+", "OpenMV-Boards(/50-IMXRT-Boards)?$"
"examples/50-OpenMV-Boards/51-Pure-Thermal", "OPENMVPT", ".+", "OpenMV-Boards(/51-Pure-Thermal)?$"
"examples/50-OpenMV-Boards/60-Shields", "OPENMV.+", ".+", "OpenMV-Boards(/60-Shields)?$"
"examples/50-Arduino-Boards/Giga-H7", "ARDUINO_GIGA", ".+", "Arduino-Boards(/Giga-H7)?$"
"examples/50-Arduino-Boards/Nano-33-BLE-Sense", "ARDUINO_NANO_33_BLE_SENSE", ".+", "Arduino-Boards(/Nano-33-BLE-Sense)?$"
"examples/50-Arduino-Boards/Nano-RP2040", "ARDUINO_NANO_RP2040_CONNECT", ".+", "Arduino-Boards(/Nano-RP2040)?$"

Can't render this file because it contains an unexpected character in line 1 and column 3.