有谁知道为什么 button2 可以工作而 button1 不行
Button2 与 GP14 和地连接 Button1 与 GP15 和地连接
Button1 始终为高
from machine import Pin
from time import sleep
motorRight = Pin(18, Pin.OUT)
motorLeft = Pin(16, Pin.OUT)
button1 = Pin(15, Pin.IN, Pin.PULL_UP)
button2 = Pin(14, Pin.IN, Pin.PULL_UP)
while True:
if not button1.value():
motorLeft.value(0)
motorRight.value(1)
print(button1.value(), "BTN: 1")
sleep(0.1)
if not button2.value():
motorRight.value(0)
motorLeft.value(1)
print(button2.value(), "BTN: 2")
sleep(0.1)
答案 0 :(得分:1)
在早期的 Micropython Pico 构建中,GP15 存在一些问题。现在应该已经修复了。您可以尝试另一个引脚或尝试最新的固件(截至本文发布时为 1.14 版本)并查看。