GPIO

背景知识

管脚控制 输入输出

引脚模式解析

? 什么时候用哪种模式, 每种模式的介绍 Pin.AF_OD initialize the pin to alternate-function mode with an open-drain drive

Pin.AF_PP initialize the pin to alternate-function mode with a push-pull drive

Pin.ANALOG initialize the pin to analog mode

Pin.IN initialize the pin to input mode

Pin.OUT_OD initialize the pin to output mode with an open-drain drive

Pin.OUT_PP initialize the pin to output mode with a push-pull drive

Pin.PULL_DOWN enable the pull-down resistor on the pin

Pin.PULL_NONE don’t enable any pull up or down resistors on the pin

Pin.PULL_UP enable the pull-up resistor on the pin

pin

# 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())
Copyright 杭州云江科技有限公司 2017 all right reserved,powered by Gitbook该文件修订时间: 2018-04-02 09:53:12

results matching ""

    No results matching ""