openmv/scripts/examples/OpenMV/02-Board-Control/pin_control.py
iabdalkader 5a6b4b2f1c Update Examples.
* Move examples to sub dirs.
* Add Arduino examples dir.
2020-11-16 23:03:02 +02:00

14 lines
358 B
Python

# Pin Control Example
#
# This example shows how to use the I/O pins in GPIO mode on your OpenMV Cam.
from pyb 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_PP, Pin.PULL_NONE)
while(True):
pin1.value(not pin0.value())