LoginSignup
2
1

More than 5 years have passed since last update.

PIRセンサーモジュール [DSUN-PIR]で遊ぶ

Last updated at Posted at 2017-02-08

DSUN-PIR 人感センサー

買ったのは
DSUN-PIR
http://www.aitendo.com/product/10254

#!/usr/local/bin/python

-- coding: utf-8 --

from future import print_function
import RPi.GPIO as GPIO
import os
import time
SENSOR_PIN = 25
LED_PIN = 24
GPIO.setmode(GPIO.BCM)
GPIO.setup(SENSOR_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(LED_PIN, GPIO.OUT)
while True:
   pin_status = GPIO.input(SENSOR_PIN)
   print(pin_status)
   GPIO.output(LED_PIN, pin_status)
   time.sleep(1)
GPIO.cleanup()

LEDを24番にさせば光る

調整

正面からみて
左 検出間隔
右 検出距離
っぽい

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1