반응형
1. 라즈베리파이 재단에서 제공하는 기본 라이브러리
GPIO Zero
GPIO Zero: a friendly Python API for physical computing - Raspberry Pi
Physical computing is one of the most engaging classroom activities, and it’s at the heart of most projects we see in the community. From flashing lights to IoT smart homes, the Pi’s GPIO pins make programming objects in the real world accessible to e
www.raspberrypi.org
pinout
라즈베리파이 제로에서 사용가능한 GPIO 를 아래와 같이 요약되어 확인할 수 있다.

혹시나 위와같이 GPIO Zero 를 볼 수 없으면 아래와 같이 설치
sudo apt install python3-gpiozero
2. 테스트 코드
from gpiozero import LED //gpio모듈에서 LED 불러오기
from time import sleep //time모듈이서 sleep함수 불러오기
led = LED(4) // LED객체 생성
while True: //반복
led.on() //led 켜기 함수
sleep(1) // 1초 대기
led.off() // led 끄기 함수
sleep(1) // 1초 대기
반응형
'Open Project > (프로젝트) Smart Wall Watch (Rasp Zero)' 카테고리의 다른 글
[Step6] SmartwallClock, I2C 핸들링하기 (0) | 2021.07.28 |
---|---|
<Step5> 유용한 Tooling 설치하기 ( Samba ) (0) | 2021.07.08 |
<Step3> GitHub 프로젝트 생성 (0) | 2021.07.07 |
<Step1> Raspberrypi OS 설치하기 (0) | 2021.07.02 |
Smart wall watch 프로젝트 시작 (0) | 2021.07.02 |