Skip to content

Conversation

@jaydevs
Copy link

@jaydevs jaydevs commented Aug 28, 2016

Python Script for Sense movement using PIR motion sensor connected to raspberry pi GPIO pin 21.

Python Script for Sense movement using PIR motion sensor connected to raspberry pi GPIO pin 21.
@odyslam
Copy link
Owner

odyslam commented Aug 29, 2016

Actually I was thinking about integrating a pir sensor, sweet!
The thing is that this loop will freeze everything else, as the script will wait for the loop to end. What you do is called polling, meaning that you check the gpio x times/sec in order to see if the state changes.
In that case you can use the webiopi default gpio functions(no need to import rpi.gpio) and the threading.Timer() method in order to poll every x seconds and not constantly, so as the rest script can run.

Also you can use gpio interupts (more delicate solution) by importing an external library as you can read here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants