Created
December 30, 2018 01:51
-
-
Save sfnis/1326f904b31b0eff79e4108cb9edb04a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPi.GPIO as GPIO | |
import time | |
SENSOR_PIN = 23 | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(SENSOR_PIN, GPIO.IN) | |
def my_callback(channel): | |
# Here, alternatively, an application / command etc. can be started. | |
print('There was a movement!') | |
curl -d '' http://172.16.32.210:8060/keypress/Power | |
try: | |
GPIO.add_event_detect(SENSOR_PIN , GPIO.RISING, callback=my_callback) | |
while True: | |
time.sleep(100) | |
except KeyboardInterrupt: | |
print "Finish..." | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment