差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 | |||
mp_key_led [2023/07/31 15:53] group003 |
mp_key_led [2023/07/31 15:59] (当前版本) group003 |
||
---|---|---|---|
行 155: | 行 155: | ||
</code> | </code> | ||
- | 修改引脚编号,将它从连接到Pico核心板内部LED的引脚25更改为连接到学习板上红色LED的引脚19。这个LED的名称也最好随之修改,比如改为led_red。程序中所有用到该LED的地方,都要把名字修改过来: | + | 修改引脚编号,将它从连接到Pico核心板内部LED的引脚25更改为连接到学习板上红色LED的引脚26。这个LED的名称也最好随之修改,比如改为led_red。程序中所有用到该LED的地方,都要把名字修改过来: |
<code python> | <code python> | ||
import machine | import machine | ||
import utime | import utime | ||
- | led_red = machine.Pin(19, machine.Pin.OUT) | + | led_red = machine.Pin(26, machine.Pin.OUT) |
while True: | while True: | ||
行 243: | 行 243: | ||
<code python> | <code python> | ||
- | led_red = machine.Pin(19, machine.Pin.OUT) | + | led_red = machine.Pin(26, machine.Pin.OUT) |
key1 = machine.Pin(12, machine.Pin.IN, machine.Pin.PULL_UP) | key1 = machine.Pin(12, machine.Pin.IN, machine.Pin.PULL_UP) | ||
</code> | </code> | ||
行 431: | 行 431: | ||
key1.irq(handler=int_handler) | key1.irq(handler=int_handler) | ||
- | button_red.irq(trigger=machine.Pin.IRQ_FALLING , handler=int_handler) | + | key1.irq(trigger=machine.Pin.IRQ_FALLING , handler=int_handler) |
while True: | while True: |