Thursday, November 5, 2015

Check availability of a device via bluetooth in raspberry pi

 #!/usr/bin/python  
import bluetooth
import time
while True:
print "Checking " + time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime())
result = bluetooth.lookup_name('1C:66:AA:CF:DD:35', timeout=5)
if (result != None):
print "Available"
else:
print "Not Available"
time.sleep(60)

No comments:

Post a Comment