Simulator warnings, etc.
This commit is contained in:
Родитель
8239329c2e
Коммит
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``.
|
||||
|
||||
### Simulator
|
||||
|
||||
This function only works on the micro:bit, not in browsers.
|
||||
|
||||
### Example
|
||||
|
||||
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.
|
||||
|
||||
### 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`.
|
||||
|
||||
### Simulator
|
||||
|
||||
This function only works on the micro:bit, not in browsers.
|
||||
|
||||
### Example: Simple number receiver
|
||||
|
||||
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()
|
||||
```
|
||||
|
||||
### 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.
|
||||
|
||||
### Simulator
|
||||
|
||||
This function only works on the micro:bit, not in browsers.
|
||||
|
||||
### Example: Simple receiver
|
||||
|
||||
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
|
||||
how strong the signal is.
|
||||
|
||||
## Simulator
|
||||
### Simulator
|
||||
|
||||
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.
|
||||
|
||||
### Simulator
|
||||
|
||||
This function only works on the micro:bit, not in browsers.
|
||||
|
||||
### Example: Broadcasting acceleration
|
||||
|
||||
This example broadcasts the value of your micro:bit's ``acceleration`` in the `x` direction
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# Send String
|
||||
|
||||
|
||||
|
||||
Sends a string to other micro:bits in the area connected by radio.
|
||||
|
||||
```sig
|
||||
|
@ -12,6 +10,12 @@ radio.sendString("Hello!")
|
|||
|
||||
* `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
|
||||
|
||||
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``.
|
||||
|
||||
### Simulator
|
||||
|
||||
This function only works on the micro:bit, not in browsers.
|
||||
|
||||
### Example
|
||||
|
||||
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
|
||||
measured as +4 dBm.
|
||||
|
||||
## Range
|
||||
### Range
|
||||
|
||||
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
|
||||
|
@ -19,6 +19,10 @@ can reach as far as 70 meters (about 230 feet).
|
|||
* a [number](/reference/types/number) between ``0`` and ``7`` that
|
||||
means how strong the signal is.
|
||||
|
||||
### Simulator
|
||||
|
||||
This function only works on the micro:bit, not in browsers.
|
||||
|
||||
### Example
|
||||
|
||||
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 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.
|
||||
|
||||
```sig
|
||||
radio.writeValueToSerial()
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
* None
|
||||
This function only works on the micro:bit, not in browsers.
|
||||
|
||||
### Examples
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче