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
'공부,일 > 라즈베리 파이' 카테고리의 다른 글
PWM 제어 (0) | 2021.08.12 |
---|---|
라즈베리 파이 polling , 이벤트 방식 전압 감지 (0) | 2021.08.11 |
기본설정 및 파이썬 사용 (0) | 2021.08.10 |
nmap (0) | 2021.08.10 |
라즈베리 파이 윈도우 원격 데스크톱 접속 & 한글화 (0) | 2021.07.14 |
댓글