일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
29 | 30 | 31 |
Tags
- YMODEM
- AWS
- 에버온
- 펌웨어
- 파이썬
- flask
- lambda
- 전기차
- 보안
- 홈어시스턴트
- 안드로이드
- thread
- homeassistant
- 디자인패턴
- 전기차충전기
- esp8266
- 전기차충전
- 라즈베리파이
- OCPP
- dynamodb
- 완속충전기
- 급속충전기
- everon
- 충전기
- STM32
- 플라스크
- IOT Core
- 서버리스
- Android
- raspberry
Archives
- Today
- Total
Louie NRT Story
[RaspberryPi] Led Control 본문
반응형
Writed: 3 FEB 2020
1. Circuit diagram
2. GPIO Pin
3. Code
1) Use BCM
import RPi.GPIO as GPIO
import time
LED_PIN = 17
led_status = True
GPIO.setmode(GPIO.BCM)
GPIO.setup(LED_PIN, GPIO.OUT)
try:
while True:
GPIO.output(LED_PIN, led_status)
print("LED_Status = ")
print(led_status)
led_status ^= True
time.sleep(5)
except KeyboardInterrupt:
GPIO.cleanup()
2) Use Board
import RPi.GPIO as GPIO
import time
LED_PIN = 11
led_status = True
GPIO.setmode(GPIO.BOARD)
GPIO.setup(LED_PIN, GPIO.OUT)
try:
while True:
GPIO.output(LED_PIN, led_status)
print("LED_Status = ")
print(led_status)
led_status ^= True
time.sleep(5)
except KeyboardInterrupt:
GPIO.cleanup()
4. ETC
GPIO.setup(11, GPIO.OUT)
#or
GPIO.setup(11, GPIO.IN)
5. Reference
반응형
'에너지' 카테고리의 다른 글
[LoRa] SystemBase Inc. uLory (0) | 2020.02.04 |
---|---|
[BlueTooth] HC-06 (0) | 2020.02.03 |
[나인와트] 2019 Incheon Civic Hack-Fair (0) | 2020.01.05 |
[기본상식] App 만드는 방법 (0) | 2019.12.26 |
[Node MCU ESP8266] Monitoring DHT11 via thingspeak (0) | 2019.12.24 |
Comments