Bluetooth Communication between Spike and MacBook #2245
Replies: 1 comment 2 replies
-
Don't include a name. It uses manufacturer data only. Although the CoreBluetooth docs say:
So this likely won't actually work. You could add a
You have to use the LEGO company ID, which is 919 (0x0397).
data needs the channel number and a header that give the type and length of the data data = bytes([
39, # channel
0, # indicates only one value/not a tuple
(5 << 5) | len(b"green"), # type/length header: 5=str
*b"green", # str data
])
You can read more about the protocol at https://github.com/pybricks/technical-info/blob/master/pybricks-ble-broadcast-observe.md Anything that can send the required advertisement data can work. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have two LEGO Spikes. The first Spike is using Bluetooth advertising to send a string:
And the second Spike is listening:
This is working fine!
I also have a Python script on my MacBook that is scanning Bluetooth and it is picking up the advertisements from the first Spike.
I have a second Python script running on my MacBook that is advertising. But my second Spike is not receiving it. My first Python script is also not seeing it. Here is my advertising script:
How can I get my Spike to see advertisements from my MacBoom or other devices>?
Beta Was this translation helpful? Give feedback.
All reactions