mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
18 lines
506 B
Python
18 lines
506 B
Python
# This work is licensed under the MIT license.
|
|
# Copyright (c) 2013-2024 OpenMV LLC. All rights reserved.
|
|
# https://github.com/openmv/openmv/blob/master/LICENSE
|
|
#
|
|
# Pin Control Example
|
|
#
|
|
# This example shows how to use the I/O pins in GPIO mode on your OpenMV Cam.
|
|
|
|
from machine import Pin
|
|
|
|
# Connect a switch to pin 0 that will pull it low when the switch is closed.
|
|
# Pin 1 will then light up.
|
|
pin0 = Pin("P0", Pin.IN, Pin.PULL_UP)
|
|
pin1 = Pin("P1", Pin.OUT)
|
|
|
|
while True:
|
|
pin1.value(not pin0.value())
|