Created
July 14, 2015 16:22
-
-
Save jamesabruce/da87ec62a02899a21de3 to your computer and use it in GitHub Desktop.
DIY Proximity Lock v.01
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
#!/usr/bin/python | |
import bluetooth | |
import time | |
import RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BCM) | |
RELAY = 23 | |
GPIO.setup(RELAY, GPIO.OUT) | |
while True: | |
print "Checking " + time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime()) | |
result = bluetooth.lookup_name('78:7F:70:38:51:1B', timeout=5) | |
if (result != None): | |
print "User present" | |
GPIO.output(RELAY,1) | |
else: | |
print "User out of range" | |
GPIO.output(RELAY,0) | |
time.sleep(10) | |
Is it possible to convert this to MicroPython to work on the ESP32?
Thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
HI! Thanks for this idea! How would you add more than one phone that triggers the relais?
Thanks!