icysamon blog

Raspberry Pi Pico 点灯

,
from machine import Pin, Timer
led = Pin("LED", Pin.OUT)

timer = Timer()

def blink(timer):
    led.toggle()
    
timer.init(freq = 2.5, mode = Timer.PERIODIC, callback = blink)

または

from machine import Pin
import time
led = Pin("LED", Pin.OUT)

if __name__ == "__main__":
    while True:
        led.toggle()
        time.sleep(1)

検索

icysamon

mail@icysamon.com