1
1

Raspberry Pi Pico を入手して最初にやることは、Lチカ(pico内蔵のLEDをチカチカ点灯させる)だと思います。
これが、「Raspberry Pi Pico」と「Raspberry Pi Pico W」では、Pin番号の指定が違うので注意しましょう。

Raspberry Pi Pico W / Raspberry Pi Pico WH

from machine import Pin
import time

led = Pin('LED', Pin.OUT) # Pico W は 'LED' と設定

for i in range(10):
    led.on()
    time.sleep(0.5)
    led.off()
    time.sleep(0.5)

print("LEDチカチカを、10回やりました!")

Raspberry Pi Pico / Raspberry Pi Pico H

from machine import Pin
import time

led = Pin(25, Pin.OUT) # Pico は 25 と設定

for i in range(10):
    led.on()
    time.sleep(0.5)
    led.off()
    time.sleep(0.5)

print("LEDチカチカを、10回やりました!")
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1