0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GPIOでLEDを点滅させる

Posted at

GPIOの配置

image.png
image.png
参照元公式ページ
https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#gpio-and-the-40-pin-header

プログラム

GPIO17でLEDを点滅させるプログラム

sample1.py
from gpiozero import LED
from time import sleep

led = LED(17)

while True:
    led.on()
    sleep(1)
    led.off()
    sleep(1)

回路設計

下記の条件から抵抗値を求めます。
・LEDに10mA流したい
・LEDは2.0Vの電圧降下がある
・GPIOがONの時、3.3Vになる
1.jpg

手持ちに130Ωがなく、100Ωの抵抗で作成しました。
・GPIO17(11番ピン)
・GND(6番ピン)
2.jpg

実行

python sample1.py

LEDが1秒おきにピカピカしました!

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?