๐ Raspberry Pi 4 ๋ชจ๋ธ ์ฌ์ฉ
๊ฐ๋
GPIO
General Purpose Input Output, ๋ฒ์ฉ ์ ์ถ๋ ฅ์ ์๋ฏธํฉ๋๋ค.
GPIO ํ ๋ฒํธ
๊ฐ ํ ์ ๋ณด๋ ์๋ ๋ช ๋ น์ด๋ก ํ์ธํ ์ ์์ต๋๋ค.
pinout
gpiozero
๋ผ์ฆ๋ฒ ๋ฆฌํ์ด ์ฌ๋จ์์ ๊ณต์์ผ๋ก ๋ผ์ฆ๋น์์ ํฌํจ์์ผ ๋ฐฐํฌํ๊ณ ์๋ GPIO์ ์ด์ฉ ํ์ด์ฌ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋๋ค.
์๋ ๊ณต์ ๋ฌธ์์์ ์ฌ๋ฌ ์์ ์ฝ๋๋ฅผ ๋ณผ ์ ์์ต๋๋ค. ๐
gpiozero — GPIO Zero 1.6.2 Documentation
Pin factories GPIO Zero builds on a number of underlying pin libraries, including RPi.GPIO and pigpio, each with their own benefits. You can select a particular pin library to be used, either for the whole script or per-device, according to your needs. See
gpiozero.readthedocs.io
์ค์ต
๐ LED 1์ด๋ง๋ค ํค๊ณ ๋๊ธฐ
ํ์ด์ฌ ์ฝ๋
from gpiozero import LED
from time import sleep # time์ผ๋ก๋ถํฐ sleep์ ๊ฐ์ ธ์ค๊ฒ ๋ค
led = LED(25) # GPIO25
while True:
led.on() # led ํค๊ธฐ
sleep(1) # delay 1์ด ์ผ
led.off() # led ํฌ๊ธฐ
sleep(1) # delay 1์ด ์ผ
์คํํ๊ธฐ
python <์คํ์ํฌ ํ์ผ๋ช
>
โจโจโจ