Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 1차원 DP
- 2차원 dp
- 99클럽
- @BeforeAll
- @BeforeEach
- @Builder
- @Entity
- @GeneratedValue
- @GenericGenerator
- @NoargsConstructor
- @Query
- @Table
- @Transactional
- Actions
- Amazon EFS
- amazon fsx
- Android Studio
- ANSI SQL
- ApplicationEvent
- assertThat
- async/await
- AVG
- AWS
- Azure
- bind
- builder
- button
- c++
- c++ builder
- c03
Archives
- Today
- Total
기록
LED 제어하기 본문
브레드보드 연결하기
라즈베리파이 | LED |
GPIO4 | + |
GND | - |
코드
#-*- coding:utf-8 -*-
import RPi.GPIO as GPIO
import time
# 사용할 gpio핀의 번호를 선정
led_pin = 4 #GPIO4
# 불필요한 wraning 제거
GPIO.setwarnings(False)
# GPIO핀의 번호모드 설정
GPIO.setmode(GPIO.BCM)
# LED핀의 IN/OUT 설정
GPIO.setup(led_pin, GPIO.OUT)
# 10번 반복
for i in range(1, 10) :
GPIO.output(led_pin,1) # LED on
time.sleep(1) # 1초 동안 대기상태
GPIO.output(led_pin,0) # LED off
time.sleep(1) # 1초 동안 대기상태
print("count=",i)
GPIO.cleanup() # GPIO 설정 초기화
실습결과
'라즈베리파이' 카테고리의 다른 글
Servo모터 제어하기 (0) | 2020.10.23 |
---|---|
PWM_LED 밝기 제어 (0) | 2020.10.20 |
버튼으로 LED 제어하기 (0) | 2020.10.18 |
Button으로 입력받기 (0) | 2020.10.17 |
Raspeberry Pi 초기설정 (0) | 2020.10.15 |
Comments