环境配置
VSCode插件
quick Start
项目位置
生成了一个示例电灯代码
烧录代码
引脚图
https://pico.nxez.com/pinout/pico/
实例
在gpio5上修改电灯效果
from machine import Pin
from utime import sleep
# 定义常量来表示引脚编号
LED_PIN = 5
pin = Pin(LED_PIN, Pin.OUT)
# pin = Pin("LED", Pin.OUT)
print("LED starts flashing...")
while True:
try:
pin.toggle()
# pin.value(1)
print("LED is on." if pin.value() else "LED is off.")
sleep(1) # sleep 1sec
except KeyboardInterrupt:
break
pin.off()
print("Finished.")