1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ラズパイPico WでLEDチカチカ

Last updated at Posted at 2024-08-11

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回やりました!")

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?