This commit is contained in:
Peli de Halleux 2016-06-03 10:35:40 -07:00
commit b108f1538d
3 changed files with 31 additions and 27 deletions

View File

@ -147,6 +147,13 @@ input.onButtonPressed(Button.A, () => {
}); });
``` ```
#### ~hint
The ``showString`` block can show letters, numbers, and punctuation
on the micro:bit screen.
#### ~
Now try to unscramble these blocks in the editor so that the micro:bit Now try to unscramble these blocks in the editor so that the micro:bit
shows **banana** when you press button `B`. shows **banana** when you press button `B`.
@ -160,10 +167,13 @@ input.onButtonPressed(Button.B, () => {
You can find the letter `B` by clicking the letter `A` on the You can find the letter `B` by clicking the letter `A` on the
``onButtonPressed`` block. ``onButtonPressed`` block.
#### #### ~
Can you combine these blocks so your program shows **anteater** when #### Your turn!
you press `A`, but **banana** when you press `B`?
Can you combine these blocks so your program shows your real name
instead of **anteater** when you press `A`, but _your secret agent
name_ instead of **banana** when you press `B`?
### Shake ### Shake

View File

@ -5,14 +5,14 @@ Run part of a program when the micro:bit receives a
### Parameters ### Parameters
* **body** is 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``.
### Example ### Example
This program never stops. It keeps sending numbers that says how This program keeps sending numbers that says how fast the micro:bit is
fast the micro:bit is slowing down or speeding up. It also receives slowing down or speeding up. It also receives numbers for the same
numbers that say how fast nearby micro:bits are going. It thing from nearby micro:bits. It shows these numbers as a
shows these numbers as a [bar graph](/reference/led/plot-bar-graph). [bar graph](/reference/led/plot-bar-graph).
```blocks ```blocks
basic.forever(() => { basic.forever(() => {

View File

@ -1,33 +1,27 @@
# Set Transmit Power # Set Transmit Power
Sets the transmitter power for ``radio`` communications. Make the ``radio`` signal of the micro:bit stronger or weaker.
The power can be set to a value between 0 (-30dbm) and 7 (+4dbm). It can be as weak as `0` and as strong as `7`.
The scientific name for the strength of the ``radio`` signal is
**dBm**, or **decibel-milliwatts**. A signal strength of `0`
can be measured as -30 dBm, and a strength of `7` can be
measured as +4 dBm.
## Range ## Range
At power level 7, in an open area without significant interference (coming from WiFi networks or other devices operating on the 2.4 GHz range), you can get a **range of over 70m**. 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
Indoors (or with additional interference), range will be significantly reduced. can reach as far as 70 meters (about 230 feet).
## 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.
For serious applications, BLE should be considered a substantially more secure alternative.
```sig
radio.setTransmitPower(1)
```
### Parameters ### Parameters
* ``power`` -- a [number](/reference/types/number) between ``0`` and ``7``. * a [number](/reference/types/number) between ``0`` and ``7`` that
means how strong the signal is.
### Example ### Example
Sets the transmitter power to full power at 7. This program makes the ``radio`` send at full strength.
```blocks ```blocks
radio.setTransmitPower(7) radio.setTransmitPower(7)