type object 'Bluetooth' has no attribute 'BLE'
I'm trying to set up a bluetooth object exactly as described in the documentation.
I type :
from network import Bluetooth
bluetooth = Bluetooth()
bluetooth.init(id=0, mode=Bluetooth.BLE, antenna=None)
And this is what I get :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'Bluetooth' has no attribute 'BLE'
I updated the firmware, I'm using a Lopy with a Pytrack as interface boar
I don't understand what is happening. Anybody with an idea or with the same problem ?
@jmarcelino What is
bluetooth.init(id=0, mode=Bluetooth.BLE, antenna=None)used for then?
I also noticed when I was trying to run it, that
Bluetooth.BLEas the mode did not work at all.
Hi @seb ,
Ok, I went through some testing, using a hi-gain 2,4 GHz external antenna and there is absolutely no difference in the RSSI of the BLE received signal. I even "hot" unplugged the antenna with absolutely no change in RSSI and no complain from the Lopy board (I would not do this with a Lora antenna :) ).
Are you sure this function (Bluetooth.EXT_ANT) is really implemented for the Lopy using the latest up to date firmware ?
I bought this Lopy about 1 year ago (if this can be of any help).
Cheers and thanks,
Hi @seb ,
Thanks for your answer ! I'm using the latest firmware and an external PCB antenna. My problem is that I don't see absolutely no difference in signal RSSI and range of detection with and without PCB antenna.
Now if I have the confirmation from Pycom that this BLE property is active and running smoothly in the latest firmware, I will change my antenna for my next test :). I will post the results of my test here for information.
seb last edited by
This should switch between the on-board 2.4ghz antenna and the U.FL connector near said antenna. There was an issue a few firmware versions ago where this wasnt working as expected. What firmware are you running?
Thanks for the quick answer ! :)
I have another question concerning the property "antenna" (Bluetooth.EXT_ANT or Bluetooth.INT_ANT).
When I write bluetooth=Bluetooth(antenna=Bluetooth.Ext_ANT), I have no error and my script is running normally. But I don't see any concrete improvement in the RSSI of the beacons signals I'm scanning, as if this 'antenna' property had no effect at all.
Can you confirm this 'antenna' option is really doing something or it is an option that is useless for a Lopy ?
Thanks a lot,
jmarcelino last edited by
That's actually an error in the documentation, thank you for finding it.
You don't need to do
bluetooth.init(id=0, mode=Bluetooth.BLE, antenna=None), just doing
bluetooth = Bluetooth()is sufficient (and also calls init)