Closed stevo399 closed 4 years ago
Did you enable bluetooth sharing?
Bluetooth sharing is enabled on the vm, still same result. The example tries to connect to a device with the mac address "aa:bb:cc:dd:ee:ff" by default. Was I supposed to change this? I did not, and just tried running the example, and bluepy returned a connection error. Thanks for your help so far, hoping to get this figured out!
Um... You should execute python with root privilege for using bluepy. I tried execute example without root and I got PySpheroNotFoundError. Try to run example with root privilege.
sudo python3 examples/find_toy.py and sudo python3 examples/wake.py The result is the same. Do I need to pair the device in any way to my machine before running this code?
Ok. Let's check the bluepy and bluetooth. Please, run this code and send output:
from bluepy.btle import Scanner, DefaultDelegate
class ScanDelegate(DefaultDelegate):
def __init__(self):
DefaultDelegate.__init__(self)
def handleDiscovery(self, dev, isNewDev, isNewData):
if isNewDev:
print("Discovered device", dev.addr)
elif isNewData:
print("Received new data from", dev.addr)
scanner = Scanner().withDelegate(ScanDelegate())
devices = scanner.scan(10.0)
for dev in devices:
print("Device %s (%s), RSSI=%d dB" % (dev.addr, dev.addrType, dev.rssi))
for (adtype, desc, value) in dev.getScanData():
print(" %s = %s" % (desc, value))
This is copy-paste from bluepy docs.
Well, I think we may have found the problem.
After running sudo python3 blue_test.py:
Traceback (most recent call last):
File "blue_test.py", line 13, in
I think it was a hardware issue more than anything. This package works with the pi3, which I got and tested it on this week. I'm guessing it was an issue with my computer's hardware or the vm.
This should help with this issue: https://github.com/IanHarvey/bluepy/issues/218#issuecomment-350680433
In my venv, the bluepy-helper
executable is here:
sudo setcap 'cap_net_raw,cap_net_admin+eip' venv/lib/python3.7/site-packages/bluepy/bluepy-helper
I am running PySphero on an Ubuntu 20.04 LTS with Python 3.8.10 Maybe I 'm not good at programming on Ubuntu. I don't know how to connect my sphero bolt, because I can't find my device in my bluetooth list(gui on upper right corner). Maybe I don't know how to start pysphero? Here is my oprations:
install the vscode
try run code core.py、wake.py, but it doesn't work.
Traceback (most recent call last):
File "/home/zzrs123/Pysphero/pysphero/examples_lmq/wake.py", line 22, in
main()
File "/home/zzrs123/Pysphero/pysphero/examples_lmq/wake.py", line 10, in main
with Sphero(mac_address=mac_address) as sphero:
File "/home/zzrs123/.local/lib/python3.8/site-packages/pysphero/core.py", line 49, in enter
self._ble_adapter = self._ble_adapter_cls(self.mac_address)
File "/home/zzrs123/.local/lib/python3.8/site-packages/pysphero/bluetooth/gatt_adapter.py", line 39, in init
ch_force_band = self._find_characteristic(SpheroCharacteristic.force_band.value)
File "/home/zzrs123/.local/lib/python3.8/site-packages/pysphero/bluetooth/gatt_adapter.py", line 56, in _find_characteristic
raise PySpheroRuntimeError(f"Characteristic {characteristic} not found")
pysphero.exceptions.PySpheroRuntimeError: Characteristic 00020005-574f-4f20-5370-6865726f2121 not found
I am running PySphero on an Ubuntu 18.04 LTS installation in VMware, on Python 3.6. When running examples/find_toy.py, I cannot find my sphero bolt; after a second it just gives a toy not found error. I know it's not my hardware as using the Sphero EDU app in windows on the same machine I can connect to it without error. is there something I need to do aside from installing bluepy and pysphero to get it working? Bolt was the one toy this was tested and found to work on I believe.