공부,일/라즈베리 파이
라즈베리 파이 하드웨어 기본
fromnothing1
2021. 8. 11. 14:06

26 번 핀으로 LED 깜빡이는 코드 작성

#!/usr/bin/python
#-*- coding:utf-8 -*-
import RPi.GPIO as GPIO
import time
led_pin = 26
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(led_pin,GPIO.OUT)
for i in range(10):
GPIO.output(led_pin,1)
time.sleep(1)
GPIO.output(led_pin,0)
time.sleep(1)
GPIO.cleanup()
GPIO 를 조절한다.
gpio readall
: 핀의 번호랑 상태를 알려준다.

sudo cat /sys/kernel/debug/gpio
pin 의 상황을 가지고 있는 파일이다.

위으 코드 출처
GPIO - eLinux.org
General Purpose Input or Output: a generic I/O line on a SoC is often referred to as a GPIO. By definition a GPIO is a line that can be used as an input or output. In some cases vendors will to a signal that support external interrupts as a GPIO line as we
elinux.org