Lopy4 to Lopy4 with BLE get_adv() always none [Solved]
-
Hello everyone!
I was trying to connect two Lopy4 with BLE, but bluetooth.get_adv() is always returning none. Just in a few cases it and using the same code work but then stopped.import ubinascii from network import Bluetooth from time import sleep bt = Bluetooth() bt.init() bt.set_advertisement(name="lopy", manufacturer_data="lopy_v1") if bt.isscanning(): bt.stop_scan() bt.start_scan(-1) while bt.isscanning(): adv = bt.get_adv() if adv: print(adv)Both with the same code, and different names (I also try it with the same name)
Thank you
-
@amarulp Hello, I think you cannot, at same time, advertise and scan for device with a lopy but you can test it in case, with some luck it can work.
I suggest you to have on one lopy to advertise (btw you must add in your code bt.advertise(true) after your bt.set_advertisement according to documentation) and the other lopy do bluetooth scanning. -
@eric73
Thank you so much!
It worked! Also, it can scan and advertise at the same time.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login