code runs without issue on RPI v3B+
This commit is contained in:
parent
950f4f6488
commit
568867b1ee
2 changed files with 25 additions and 0 deletions
4
Raspberry_Pi_Sensing_Movement/README.md
Normal file
4
Raspberry_Pi_Sensing_Movement/README.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Raspberry_Pi_Sensing_Movement
|
||||
|
||||
Code to accompany this tutorial:
|
||||
https://learn.adafruit.com/adafruits-raspberry-pi-lesson-12-sensing-movement
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
import time
|
||||
import board
|
||||
import digitalio
|
||||
|
||||
# set up motion sensor
|
||||
pir_sensor = digitalio.DigitalInOut(board.D18)
|
||||
pir_sensor.direction = digitalio.Direction.INPUT
|
||||
|
||||
# set up door sensor
|
||||
door_sensor = digitalio.DigitalInOut(board.D23)
|
||||
door_sensor.direction = digitalio.Direction.INPUT
|
||||
|
||||
while True:
|
||||
|
||||
if pir_sensor.value:
|
||||
print("PIR ALARM!")
|
||||
|
||||
if door_sensor.value:
|
||||
print("DOOR ALARM!")
|
||||
|
||||
time.sleep(0.5)
|
||||
Loading…
Reference in a new issue