hello, world!

[라즈베리파이(RPi)] 적외선(PIR) 센서 연결 본문

Project & Study/raspberryPi

[라즈베리파이(RPi)] 적외선(PIR) 센서 연결

ferozsun 2020. 8. 12. 11:57

적외선 센서가 움직임을 감지했을 경우 "Motion Detected"를 출력한다.

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
GPIO.setup(21,GPIO.IN)

while True:
    input_state = GPIO.input(21)
    if input_state == True:
       print("Motion Detected")
    else:
	print("No Detection")
    time.sleep(0.2)

https://github.com/huunz

 

huunz

huunz has one repository available. Follow their code on GitHub.

github.com

 

Comments