I am using HC-05 bluetooth module. Want to enable two way communication with my android phone. But unable to go pass the device inquiry step... Please help me to make it work....
Python script:
from bluetooth import *
print("performing inquiry...")
nearby_devices = discover_devices()
print("found %d devices" % len(nearby_devices))
for addr, name in nearby_devices:
try:
print(" %s - %s" % (addr, name))
except UnicodeEncodeError:
print(" %s - %s" % (addr, name.encode('utf-8', 'replace')))
Above python script returns error:
Traceback (most recent call last):
File "pi_bt_inquiry.py", line 12, in <module>
nearby_devices = discover_devices()
File "/usr/lib/python2.7/dist-packages/bluetooth/bluez.py", line 17, in discover_devic es
sock = _gethcisock ()
File "/usr/lib/python2.7/dist-packages/bluetooth/bluez.py", line 226, in _gethcisock
raise BluetoothError ("error accessing bluetooth device")
bluetooth.btcommon.BluetoothError: error accessing bluetooth device