You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/radio.rst
+24-1Lines changed: 24 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -9,12 +9,13 @@ networks.
9
9
The radio module is conceptually very simple:
10
10
11
11
* Broadcast messages are of a certain configurable length (up to 251 bytes).
12
-
* Messages received are read from a queue of configurable size (the larger the queue the more RAM is used). If the queue is full, new messages are ignored.
12
+
* Messages received are read from a queue of configurable size (the larger the queue the more RAM is used). If the queue is full, new messages are ignored. Reading a message removes it from the queue.
13
13
* Messages are broadcast and received on a preselected channel (numbered 0-100).
14
14
* Broadcasts are at a certain level of power - more power means more range.
15
15
* Messages are filtered by address (like a house number) and group (like a named recipient at the specified address).
16
16
* The rate of throughput can be one of three pre-determined settings.
17
17
* Send and receieve bytes to work with arbitrary data.
18
+
* Use `receive_full` to obtain full details about an incoming message: receiving signal strength and the device's `running_time` when the message arrived.
18
19
* As a convenience for children, it's easy to send and receive messages as strings.
19
20
* The default configuration is both sensible and compatible with other platforms that target the BBC micro:bit.
20
21
@@ -132,6 +133,28 @@ Functions
132
133
133
134
A ``ValueError`` exception is raised if conversion to string fails.
134
135
136
+
.. py:function:: receive_full()
137
+
138
+
Returns a tuple containing three values representing the next incoming
139
+
message on the message queue. If there are no pending messages then
140
+
``None`` is returned.
141
+
142
+
The three values in the tuple represent:
143
+
144
+
* the next incoming message on the message queue as bytes.
145
+
* the RSSI (signal strength): a value between 0 (strongest) and -255 (weakest) as measured in dBm.
146
+
* a timestamp: the value returned by `microbit.running_time` when the message was receieved.
147
+
148
+
For example::
149
+
150
+
details = radio.receive_full()
151
+
if details:
152
+
msg, rssi, timestamp = details
153
+
154
+
This function is useful for providing information needed for triangulation
155
+
and/or triliteration with other micro:bit devices.
0 commit comments