From 4941ce1694ec4c19f9be94b146c866ec57bc219d Mon Sep 17 00:00:00 2001 From: Ron Hale-Evans Date: Mon, 18 Jul 2016 14:04:15 -0700 Subject: [PATCH] Fixing parameters --- docs/reference/radio/on-data-received.md | 5 +++-- docs/reference/radio/receive-number.md | 4 ++++ docs/reference/radio/receive-string.md | 3 ++- docs/reference/radio/received-signal-strength.md | 4 ++++ docs/reference/radio/send-number.md | 15 +++++++++------ docs/reference/radio/send-string.md | 9 ++++----- docs/reference/radio/send-value.md | 8 ++++++-- docs/reference/radio/set-group.md | 4 ++++ docs/reference/radio/set-transmit-power.md | 6 +++++- docs/reference/radio/write-value-to-serial.md | 7 +++++-- 10 files changed, 46 insertions(+), 19 deletions(-) diff --git a/docs/reference/radio/on-data-received.md b/docs/reference/radio/on-data-received.md index 56da6042..a5010a0c 100644 --- a/docs/reference/radio/on-data-received.md +++ b/docs/reference/radio/on-data-received.md @@ -3,9 +3,10 @@ Run part of a program when the micro:bit receives a [number](/reference/types/number) or [string](/reference/types/string) over ``radio``. -### Parameters -* the part of the program to run when the micro:bit receives information over ``radio``. +```sig +radio.onDataReceived(() => { }); +``` ### Simulator diff --git a/docs/reference/radio/receive-number.md b/docs/reference/radio/receive-number.md index f0a375c6..fafc467e 100644 --- a/docs/reference/radio/receive-number.md +++ b/docs/reference/radio/receive-number.md @@ -2,6 +2,10 @@ Receives the next number sent by a micro:bit in the same ``radio`` group. +```sig +radio.receiveNumber(); +``` + ### Returns * the first [number](/reference/types/number) that the micro:bit received. If it did not receive any numbers, this function will return `0`. diff --git a/docs/reference/radio/receive-string.md b/docs/reference/radio/receive-string.md index 822338c7..f2908279 100644 --- a/docs/reference/radio/receive-string.md +++ b/docs/reference/radio/receive-string.md @@ -8,7 +8,8 @@ radio.receiveString() ### 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 diff --git a/docs/reference/radio/received-signal-strength.md b/docs/reference/radio/received-signal-strength.md index 513e8164..b1ddf212 100644 --- a/docs/reference/radio/received-signal-strength.md +++ b/docs/reference/radio/received-signal-strength.md @@ -8,6 +8,10 @@ the last time it ran the [receive number](/reference/radio/receive-number) function. That means it needs to run **receive number** first. +```sig +radio.receivedSignalStrength(); +``` + ### Returns * a [number](/reference/types/number) between `255` and `0` that means diff --git a/docs/reference/radio/send-number.md b/docs/reference/radio/send-number.md index ce79122e..5bb921c9 100644 --- a/docs/reference/radio/send-number.md +++ b/docs/reference/radio/send-number.md @@ -1,10 +1,14 @@ # Send Number -Broadcast a number to other micro:bits connected via ``radio``. +Broadcast a [number](/reference/types/number) to other micro:bits connected via ``radio``. + +```sig +radio.sendNumber(0); +``` ### Parameters -* num - a number to send. +* ``value`` - a [number](/reference/types/number) to send. ### Simulator @@ -12,9 +16,9 @@ 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 -(left and right) to other micro:bits. -This kind of program might be useful in a model car or model rocket. +This example broadcasts the value of your micro:bit's ``acceleration`` +in the `x` direction (left and right) to other micro:bits. This kind +of program might be useful in a model car or model rocket. ```blocks input.onButtonPressed(Button.A, () => { @@ -39,4 +43,3 @@ basic.forever(() => { ### See also [receive number](/reference/radio/receive-number), [on data received](/reference/radio/on-data-received) - diff --git a/docs/reference/radio/send-string.md b/docs/reference/radio/send-string.md index 8725fa72..eb7572a3 100644 --- a/docs/reference/radio/send-string.md +++ b/docs/reference/radio/send-string.md @@ -8,18 +8,17 @@ radio.sendString("Hello!") ### Parameters -* `text` is a [String](/reference/types/string) to send by radio. +* `msg` 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`. -The other micro:bits will receive the code word and then show it. +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`. The +other micro:bits will receive the code word and then show it. ```blocks input.onButtonPressed(Button.A, () => { diff --git a/docs/reference/radio/send-value.md b/docs/reference/radio/send-value.md index a9ad5a83..cd188b9d 100644 --- a/docs/reference/radio/send-value.md +++ b/docs/reference/radio/send-value.md @@ -2,10 +2,14 @@ Send a [string]() and [number]() together by ``radio`` to other micro:bits. +```sig +radio.sendValue("data", 0); +``` + ### Parameters -* a [string](/reference/types/string) to send by radio -* a [number](/reference/types/number) to send by radio +* ``name`` is a [string](/reference/types/string) to send by radio +* ``value`` a [number](/reference/types/number) to send by radio ### Simulator diff --git a/docs/reference/radio/set-group.md b/docs/reference/radio/set-group.md index 9ce88acf..a8cfd4e9 100644 --- a/docs/reference/radio/set-group.md +++ b/docs/reference/radio/set-group.md @@ -10,6 +10,10 @@ function, it will figure out its own group ID by itself. If you load the very same program onto two different micro:bits, they will be able to talk to each other because they will have the same group ID. +```sig +radio.setGroup(0); +``` + ### Parameters * ``id`` is a [number](/reference/types/number) from ``0`` to ``255``. diff --git a/docs/reference/radio/set-transmit-power.md b/docs/reference/radio/set-transmit-power.md index 941f1359..61e27325 100644 --- a/docs/reference/radio/set-transmit-power.md +++ b/docs/reference/radio/set-transmit-power.md @@ -8,6 +8,10 @@ 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. +```sig +radio.setTransmitPower(7); +``` + ### Range If your micro:bit is sending with a strength of `7`, and you are in @@ -16,7 +20,7 @@ can reach as far as 70 meters (about 230 feet). ### Parameters -* a [number](/reference/types/number) between ``0`` and ``7`` that +* ``power`` is a [number](/reference/types/number) between ``0`` and ``7`` that means how strong the signal is. ### Simulator diff --git a/docs/reference/radio/write-value-to-serial.md b/docs/reference/radio/write-value-to-serial.md index 8abbcd61..390e3e46 100644 --- a/docs/reference/radio/write-value-to-serial.md +++ b/docs/reference/radio/write-value-to-serial.md @@ -1,16 +1,19 @@ # Write Value To Serial Writes the full data received data via ``radio`` to serial in JSON format. + **Note** - This method only works for [send number](/reference/radio/send-number) and [send value](/reference/radio/send-value). It does not work for [send string](/reference/radio/send-string) (although a string can be sent with [send value](/reference/radio/send-value)). +```sig +radio.writeValueToSerial(); +``` + ## Data received format The format for received data printed to serial is as follows - [send number](/reference/radio/send-number) - ```{v:ValueSent,t:MicrobitTimeAlive,s:Unused}``` - [send value](/reference/radio/send-number) - ```{v:Value,t:MicrobitTimeAlive,s:Unused,n:"Name"}``` - [send string](/reference/radio/send-string) - ```{}``` (currently unavailable) - - ### Simulator This function only works on the micro:bit, not in browsers.