Simulator warnings, etc.
This commit is contained in:
parent
8239329c2e
commit
3049c88d5b
@ -7,6 +7,10 @@ Run part of a program when the micro:bit receives a
|
|||||||
|
|
||||||
* the part of the program to run when the micro:bit receives information over ``radio``.
|
* the part of the program to run when the micro:bit receives information over ``radio``.
|
||||||
|
|
||||||
|
### Simulator
|
||||||
|
|
||||||
|
This function only works on the micro:bit, not in browsers.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
This program keeps sending numbers that says how fast the micro:bit is
|
This program keeps sending numbers that says how fast the micro:bit is
|
||||||
|
@ -2,10 +2,14 @@
|
|||||||
|
|
||||||
Receives the next number sent by a micro:bit in the same ``radio`` group.
|
Receives the next number sent by a micro:bit in the same ``radio`` group.
|
||||||
|
|
||||||
### Return value
|
### Returns
|
||||||
|
|
||||||
* the first [number](/reference/types/number) that the micro:bit received. If it did not receive any numbers, this function will return `0`.
|
* the first [number](/reference/types/number) that the micro:bit received. If it did not receive any numbers, this function will return `0`.
|
||||||
|
|
||||||
|
### Simulator
|
||||||
|
|
||||||
|
This function only works on the micro:bit, not in browsers.
|
||||||
|
|
||||||
### Example: Simple number receiver
|
### Example: Simple number receiver
|
||||||
|
|
||||||
This example receives the number broadcasted another micro:bit and shows it
|
This example receives the number broadcasted another micro:bit and shows it
|
||||||
|
@ -6,10 +6,14 @@ Find the next string sent by `radio` from another micro:bit.
|
|||||||
radio.receiveString()
|
radio.receiveString()
|
||||||
```
|
```
|
||||||
|
|
||||||
### Return value
|
### Returns
|
||||||
|
|
||||||
* the first [string](/reference/types/string) that was sent. If no string was sent, then this function returns an empty (blank) string.
|
* the first [string](/reference/types/string) that was sent. If no string was sent, then this function returns an empty (blank) string.
|
||||||
|
|
||||||
|
### Simulator
|
||||||
|
|
||||||
|
This function only works on the micro:bit, not in browsers.
|
||||||
|
|
||||||
### Example: Simple receiver
|
### Example: Simple receiver
|
||||||
|
|
||||||
Show the string sent by another micro:bit.
|
Show the string sent by another micro:bit.
|
||||||
|
@ -13,7 +13,7 @@ it needs to run **receive number** first.
|
|||||||
* a [number](/reference/types/number) between `255` and `0` that means
|
* a [number](/reference/types/number) between `255` and `0` that means
|
||||||
how strong the signal is.
|
how strong the signal is.
|
||||||
|
|
||||||
## Simulator
|
### Simulator
|
||||||
|
|
||||||
This function only works on the micro:bit, not in browsers.
|
This function only works on the micro:bit, not in browsers.
|
||||||
|
|
||||||
|
@ -6,6 +6,10 @@ Broadcast a number to other micro:bits connected via ``radio``.
|
|||||||
|
|
||||||
* num - a number to send.
|
* num - a number to send.
|
||||||
|
|
||||||
|
### Simulator
|
||||||
|
|
||||||
|
This function only works on the micro:bit, not in browsers.
|
||||||
|
|
||||||
### Example: Broadcasting acceleration
|
### Example: Broadcasting acceleration
|
||||||
|
|
||||||
This example broadcasts the value of your micro:bit's ``acceleration`` in the `x` direction
|
This example broadcasts the value of your micro:bit's ``acceleration`` in the `x` direction
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
# Send String
|
# Send String
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Sends a string to other micro:bits in the area connected by radio.
|
Sends a string to other micro:bits in the area connected by radio.
|
||||||
|
|
||||||
```sig
|
```sig
|
||||||
@ -12,6 +10,12 @@ radio.sendString("Hello!")
|
|||||||
|
|
||||||
* `text` is a [String](/reference/types/string) to send by radio.
|
* `text` is a [String](/reference/types/string) to send by radio.
|
||||||
|
|
||||||
|
### Simulator
|
||||||
|
|
||||||
|
This function only works on the micro:bit, not in browsers.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Example: Two-way radio
|
### Example: Two-way radio
|
||||||
|
|
||||||
If you load this program onto two or more micro:bits, you can send a code word from one of them to the others by pressing button `A`.
|
If you load this program onto two or more micro:bits, you can send a code word from one of them to the others by pressing button `A`.
|
||||||
|
@ -14,6 +14,10 @@ to talk to each other because they will have the same group ID.
|
|||||||
|
|
||||||
* ``id`` is a [number](/reference/types/number) from ``0`` to ``255``.
|
* ``id`` is a [number](/reference/types/number) from ``0`` to ``255``.
|
||||||
|
|
||||||
|
### Simulator
|
||||||
|
|
||||||
|
This function only works on the micro:bit, not in browsers.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
This program makes the group ID equal 128.
|
This program makes the group ID equal 128.
|
||||||
|
@ -8,7 +8,7 @@ The scientific name for the strength of the ``radio`` signal is
|
|||||||
can be measured as -30 dBm, and a strength of `7` can be
|
can be measured as -30 dBm, and a strength of `7` can be
|
||||||
measured as +4 dBm.
|
measured as +4 dBm.
|
||||||
|
|
||||||
## Range
|
### Range
|
||||||
|
|
||||||
If your micro:bit is sending with a strength of `7`, and you are in
|
If your micro:bit is sending with a strength of `7`, and you are in
|
||||||
an open area without many other computers around, the micro:bit signal
|
an open area without many other computers around, the micro:bit signal
|
||||||
@ -19,6 +19,10 @@ can reach as far as 70 meters (about 230 feet).
|
|||||||
* a [number](/reference/types/number) between ``0`` and ``7`` that
|
* a [number](/reference/types/number) between ``0`` and ``7`` that
|
||||||
means how strong the signal is.
|
means how strong the signal is.
|
||||||
|
|
||||||
|
### Simulator
|
||||||
|
|
||||||
|
This function only works on the micro:bit, not in browsers.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
This program makes the ``radio`` send at full strength.
|
This program makes the ``radio`` send at full strength.
|
||||||
|
@ -9,21 +9,11 @@ The format for received data printed to serial is as follows
|
|||||||
- [send value](/reference/radio/send-number) - ```{v:Value,t:MicrobitTimeAlive,s:Unused,n:"Name"}```
|
- [send value](/reference/radio/send-number) - ```{v:Value,t:MicrobitTimeAlive,s:Unused,n:"Name"}```
|
||||||
- [send string](/reference/radio/send-string) - ```{}``` (currently unavailable)
|
- [send string](/reference/radio/send-string) - ```{}``` (currently unavailable)
|
||||||
|
|
||||||
## Important Security Consideration
|
|
||||||
|
|
||||||
The functions in the ``radio`` namespace allow the BBC micro:bit to communicate with other micro:bits.
|
|
||||||
|
|
||||||
This API does not contain any form of encryption, authentication or authorization. It's purpose is solely for use as a teaching aid to demonstrate how simple communications operates, and to provide a sandpit through which learning can take place.
|
### Simulator
|
||||||
|
|
||||||
For serious applications, BLE should be considered a substantially more secure alternative.
|
This function only works on the micro:bit, not in browsers.
|
||||||
|
|
||||||
```sig
|
|
||||||
radio.writeValueToSerial()
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
* None
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user