用户工具

站点工具


icore3_micropython_3

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
后一修订版 两侧同时换到之后的修订记录
icore3_micropython_3 [2020/06/15 16:34]
zgf
icore3_micropython_3 [2020/06/17 15:28]
zgf
行 18: 行 18:
  
 按键的一端与STM32的GPIO(PH15)相连,另一端接地,当按键按下时,PH15被短接到GND,呈低电平。示意图如下图所示: 按键的一端与STM32的GPIO(PH15)相连,另一端接地,当按键按下时,PH15被短接到GND,呈低电平。示意图如下图所示:
-{{ :​micropython_3_1.png?​nolink&600 |硬件连接图}}+{{ :icore3:​micropython_3_1.png?​direct&600 |硬件连接图}}
 ==== 四、实验步骤 ==== ==== 四、实验步骤 ====
  
行 27: 行 27:
  
 iCore3双核心板上ARM-KEY按下蓝灯亮,按键松开蓝灯灭。 iCore3双核心板上ARM-KEY按下蓝灯亮,按键松开蓝灯灭。
 +==== 六、实验程序 ====
 +
 +<code python>
 +# -*- coding: utf-8-*-
 +# main.py -- put your code here!
 +from pyb import Pin    #​导入引脚库
 +
 +key = Pin('​H15',​ Pin.IN, Pin.PULL_UP) #​创建按键对象,输入上拉,默认高电平
 +
 +while True:             #​循环
 +    if key() == 0:      #​如果按键按下
 +        pyb.LED(3).on() #蓝灯亮
 +    else:
 +        pyb.LED(3).off()#​蓝灯灭
 +</​code>​
icore3_micropython_3.txt · 最后更改: 2022/03/18 15:15 由 sean