@@ -11,17 +11,6 @@ video:
1111 youtube : " i--8nBvNn_4"
1212---
1313
14- # Experimental features ahead!
15-
16- Hub to hub communication is still a work in progress. This page explains how
17- you can install an experimental release on the hub to try it out. This
18- functionality may change in the future and some things may not work.
19-
20- Last changed on 2023-05-16. Be sure to use [ Pybricks Beta] and the most recent
21- firmware.
22-
23- [ Pybricks Beta ] : https://beta.pybricks.com
24-
2514# Data broadcasting
2615
2716When a Bluetooth device is on but not yet connected to anything, it typically
@@ -64,10 +53,11 @@ hub = ThisHub(observe_channels=[1, 2])
6453You can send data like this:
6554
6655``` python
67- roll, pitch = sensor.tilt()
56+ # Get a tuple of pitch and roll angles.
57+ data = sensor.tilt()
6858
6959# Send it out to anyone listening.
70- hub.ble.broadcast(roll, pitch )
60+ hub.ble.broadcast(data )
7161```
7262
7363On another hub, you can receive it as follows:
@@ -86,7 +76,7 @@ if data is not None:
8676When sending data, your values will be automatically encoded into a format
8777suitable for broadcasting. You can send integers (` 1 ` , ` -5 ` , ...), floats
8878(` 1.0 ` ` -5.3 ` , ...), booleans (` True ` , ` False ` ), strings (` "example" ` ), bytes
89- (` b"\x00\x02" ` ) and ` None ` .
79+ (` b"\x00\x02" ` ) or tuples thereof .
9080
9181
9282# Running the example programs
@@ -97,7 +87,7 @@ wireless bidirectional communication.
9787One hub sends tilt sensor data to control a driving vehicle. The vehicle
9888sends back a distance measurement to show a warning light for nearby obstacles:
9989
100- ** Run this program on the remote **
90+ ** Run this program on the sender **
10191
10292You can use any hub with any type of sensor. For example, you could use the
10393built-in tilt sensor of the Technic Hub, Prime Hub, Essential Hub, or the
@@ -126,13 +116,7 @@ sensor, you can delete the lines that make use of the Ultrasonic Sensor.
126116
127117If the hub is still connected to the computer, the bluetooth chip is quite busy
128118and data broadcasting may be slow. Especially on the Technic Hub and the City
129- Hub.
119+ Hub. On the Move Hub, it cannot broadcast at all while connected to the PC.
130120
131121To work around it, just load the program onto the hub and disconnect from your
132122computer. You can just restart the program with the hub button.
133-
134- # Known issue: Broadcasting using the City hub does not work
135-
136- There is a bug in the Bluetooth chip firmware that prevents broadcasting
137- from working properly on the City hub. It was working in previous experimental
138- implementations because we were broadcasting data the "wrong" way.
0 commit comments