Jun-08-2020, 11:22 PM
Hi there.
I'm trying to create an Indoor Positioning System using iBeacon signal, Bluepy and Raspberry Pi Zero W. Basically my Python code (which I refer tutorial on the Internet) can read the RSSI value from my BLE beacon. Below is my python code to scan and print the RSSI value of iBeacon:
Thanks in advance for help.
I'm trying to create an Indoor Positioning System using iBeacon signal, Bluepy and Raspberry Pi Zero W. Basically my Python code (which I refer tutorial on the Internet) can read the RSSI value from my BLE beacon. Below is my python code to scan and print the RSSI value of iBeacon:
#!/usr/bin/python3
import time
from bluepy.btle import Scanner, DefaultDelegate
class ScanDelegate(DefaultDelegate):
def __init__(self):
DefaultDelegate.__init__(self)
def HandleDiscovery(self,dev,new_dev,new_dat):
if new_dev:
pass
if new_dat:
pass
scanner = Scanner().withDelegate(ScanDelegate())
time_diff = 0
first_time = 1
while 1:
try:
devices = scanner.scan(0.35)
## print("Amount of Devices = "+str(len(devices)))
for ii in devices:
## print(ii.addr)
if ii.addr == '50:51:a9:fe:b4:c6':
print("Device %s, RSSI=%d dB" % (ii.addr,ii.rssi))
if first_time == 1:
first_time = 0
pass
else:
time_diff = time.time()-time_prev
time_prev = time.time()
rssi_prev = ii.rssi
continue
except:
continueSo now, I need to create a list of this RSSI value, UUID and all the data related before I can send them to a server. Since I'm new to this Python programming, so I don't know how to put all the informations that I get in a list.Thanks in advance for help.
