pxt-microbit Accessibility PR (#529)

* Accessibility changes
This commit is contained in:
Sam El-Husseini
2017-09-07 13:42:08 -07:00
committed by GitHub
parent 3f87576a50
commit e3975e65e5
357 changed files with 1641 additions and 3540 deletions

View File

@ -8,13 +8,13 @@ Run part of a program when the @boardname@ receives a
radio.onDataPacketReceived(({receivedNumber, receivedString, time, serial, signal}) => { });
```
### ~hint
## ~hint
To add or remove the parts of the packet from the block, try clicking the blue gear in the corner!
### ~
## ~
### Callback Parameters
## Callback Parameters
* ``packet`` - the [packet](/reference/radio/packet) that was received by the radio. The packet has the following properties:
* `receivedNumber` - The [number](/types/number) that was sent in this packet or `0` if this packet did not contain a number. See [send number](/reference/radio/send-number) and [send value](/reference/radio/send-value)
@ -23,7 +23,7 @@ To add or remove the parts of the packet from the block, try clicking the blue g
* `serial` - The serial number of the @boardname@ that sent this packet or `0` if the @boardname@ did not include its serial number.
* `signal` - How strong the radio signal is from `-128` (weak) to `-42` (strong).
### Example
## Example
This program keeps sending numbers that says how fast the @boardname@ is
slowing down or speeding up. It also receives numbers for the same
@ -39,7 +39,7 @@ radio.onDataPacketReceived(({ receivedNumber }) => {
})
```
### Example
## Example
This program uses the signal strength from received packets to graph the
approximate distance between two @boardname@s.
@ -56,7 +56,7 @@ radio.onDataPacketReceived(({ signal, receivedNumber }) => {
})
```
### See also
## See also
[send number](/reference/radio/send-number),
[send string](/reference/radio/send-string),

View File

@ -10,7 +10,7 @@ Run part of a program when the @boardname@ receives a
radio.onDataReceived(() => { });
```
### Example
## Example
This program keeps sending numbers that says how fast the @boardname@ is
slowing down or speeding up. It also receives numbers for the same
@ -26,7 +26,7 @@ radio.onDataReceived(() => {
})
```
### See also
## See also
[on data packet received](/reference/radio/on-data-packet-received),
[send number](/reference/radio/send-number), [set group](/reference/radio/set-group)

View File

@ -10,7 +10,7 @@ A packet that was received by the radio.
* `serial` - The serial number of the @boardname@ that sent this packet or `0` if the @boardname@ did not include its serial number.
* `signal` - How strong the radio signal is from `255` (weak) to `0` (strong).
### See also
## See also
[on data packet received](/reference/radio/on-data-packet-received),

View File

@ -8,11 +8,11 @@ Receives the next number sent by a @boardname@ in the same ``radio`` group.
radio.receiveNumber();
```
### Returns
## Returns
* the first [number](/types/number) that the @boardname@ received. If it did not receive any numbers, this function will return `0`.
### Example: Simple number receiver
## Example: Simple number receiver
This example receives the number broadcasted another @boardname@ and shows it
as a bar graph.
@ -23,7 +23,7 @@ radio.onDataReceived(() => {
})
```
### Example: Light level receiver
## Example: Light level receiver
This example shows the light level from the [light level sender example](/reference/radio/send-number)
as a number.
@ -36,7 +36,7 @@ basic.forever(() => {
})
```
### Example: Mailbot
## Example: Mailbot
This example receives the light level from the [light level sender example](/reference/radio/send-number)
and shows a text string like **ALERT** if the light level becomes much brighter.
@ -58,7 +58,7 @@ basic.forever(() => {
})
```
### See also
## See also
[send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)

View File

@ -8,12 +8,12 @@ Find the next string sent by `radio` from another @boardname@.
radio.receiveString()
```
### Returns
## Returns
* the first [string](/types/string) that was sent. If no
string was sent, then this function returns an empty (blank) string.
### Example: Simple receiver
## Example: Simple receiver
Show the string sent by another @boardname@.
@ -23,7 +23,7 @@ radio.onDataReceived(() => {
});
```
### Example: Two-way radio
## Example: Two-way radio
If you load this program onto two or more @boardname@s, you can send a code word from one of them to the others by pressing button `A`.
The other @boardname@s will receive the code word and then show it.
@ -39,13 +39,13 @@ radio.onDataReceived(() => {
});
```
### ~hint
## ~hint
A radio that can both transmit and receive is called a _transceiver_.
### ~
## ~
### Example: Mood radio
## Example: Mood radio
This is a simple program to send whether you are happy or sad over ```radio```.
Use the `A` or `B` button to select an emotion.
@ -84,7 +84,7 @@ radio.onDataReceived(() => {
});
```
### See also
## See also
[send string](/reference/radio/send-string), [on data received](/reference/radio/on-data-received)

View File

@ -14,16 +14,16 @@ it needs to run **receive number** first.
radio.receivedSignalStrength();
```
### Returns
## Returns
* a [number](/types/number) between `-128` and `-42` that means
how strong the signal is.
### Simulator
## Simulator
This function only works on the @boardname@, not in browsers.
### Example
## Example
This example shows how strong the radio signal of the
[light level sender example](/reference/radio/send-number) is.
@ -37,7 +37,7 @@ basic.forever(() => {
});
```
### See also
## See also
[on data packet received](/reference/radio/on-data-packet-received), [send number](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)

View File

@ -6,12 +6,12 @@ Broadcast a [number](/types/number) to other @boardname@s connected via ``radio`
radio.sendNumber(0);
```
### Parameters
## Parameters
* ``value`` - a [number](/types/number) to send.
### Example: Broadcasting acceleration
## Example: Broadcasting acceleration
This example broadcasts the value of your @boardname@'s ``acceleration``
in the `x` direction (left and right) to other @boardname@s. This kind
@ -23,7 +23,7 @@ input.onButtonPressed(Button.A, () => {
})
```
### Light level sender
## Light level sender
This example broadcasts the level of the light around it.
You can do some interesting things with it if you use it along with the
@ -37,7 +37,7 @@ basic.forever(() => {
})
```
### See also
## See also
[on data packet received](/reference/radio/on-data-packet-received)

View File

@ -7,12 +7,12 @@ maximum string length is 19 characters.
radio.sendString("Hello!")
```
### Parameters
## Parameters
* `msg` is a [string](/types/string) to send by radio.
### Example: Two-way radio
## Example: Two-way radio
If you load this program onto two or more @boardname@s, you can send a
code word from one of them to the others by pressing button `A`. The
@ -29,13 +29,13 @@ radio.onDataPacketReceived(({ receivedString }) => {
});
```
### ~hint
## ~hint
A radio that can both transmit and receive is called a _transceiver_.
### ~
## ~
### See also
## See also
[on data packet received](/reference/radio/on-data-packet-received)

View File

@ -7,12 +7,12 @@ The maximum [string]() length is 12 characters.
radio.sendValue("name", 0);
```
### Parameters
## Parameters
* ``name`` is a [string](/types/string) to send by radio
* ``value`` a [number](/types/number) to send by radio
### Example: Broadcasting acceleration
## Example: Broadcasting acceleration
This program sends your @boardname@'s **acceleration** (amount it is
speeding up or slowing down) in the `x` direction (left and right) to
@ -37,7 +37,7 @@ radio.onDataPacketReceived(({ receivedString, receivedNumber }) => {
});
```
### See also
## See also
[on data packet received](/reference/radio/on-data-packet-received)

View File

@ -14,15 +14,15 @@ to talk to each other because they will have the same group ID.
radio.setGroup(0);
```
### Parameters
## Parameters
* ``id`` is a [number](/types/number) from ``0`` to ``255``.
### Simulator
## Simulator
This function only works on the @boardname@, not in browsers.
### Example
## Example
This program makes the group ID equal 128.
@ -30,7 +30,7 @@ This program makes the group ID equal 128.
radio.setGroup(128)
```
### See also
## See also
[on data packet received](/reference/radio/on-data-packet-received),
[send number](/reference/radio/send-number),

View File

@ -12,22 +12,22 @@ measured as +4 dBm.
radio.setTransmitPower(7);
```
### Range
## Range
If your @boardname@ is sending with a strength of `7`, and you are in
an open area without many other computers around, the @boardname@ signal
can reach as far as 70 meters (about 230 feet).
### Parameters
## Parameters
* ``power`` is a [number](/types/number) between ``0`` and ``7`` that
means how strong the signal is.
### Simulator
## Simulator
This function only works on the @boardname@, not in browsers.
### Example
## Example
This program makes the ``radio`` send at full strength.
@ -35,7 +35,7 @@ This program makes the ``radio`` send at full strength.
radio.setTransmitPower(7)
```
### See also
## See also
[on data packet received](/reference/radio/on-data-packet-received),
[send number](/reference/radio/send-number),

View File

@ -6,11 +6,11 @@ Make the ``radio`` packet embed the board serial number with each packet of data
radio.setTransmitSerialNumber(true);
```
### Parameters
## Parameters
* ``transmit`` is a [boolean](/types/boolean) that represents whether the serial number needs to be transmitted.
### Example
## Example
This program makes the ``radio`` send the serial number in each packet.
@ -18,7 +18,7 @@ This program makes the ``radio`` send the serial number in each packet.
radio.setTransmitSerialNumber(true);
```
### See also
## See also
[on data packet received](/reference/radio/on-data-packet-received),
[send number](/reference/radio/send-number),

View File

@ -8,7 +8,7 @@ Should be called within a callback to
radio.writeReceivedPacketToSerial();
```
### Data received format
## Data received format
The format for received data printed to serial is as follows:
@ -16,7 +16,7 @@ The format for received data printed to serial is as follows:
- [send value](/reference/radio/send-value): ```{v:ValueSent,t:MicrobitTimeAlive,s:SerialNumber,n:"Name"}```
- [send string](/reference/radio/send-string): ```{t:MicrobitTimeAlive,s:SerialNumber,n:"Text"}```
### Examples
## Examples
When ```radio``` data is received (after pressing the ``A`` button on
the second @boardname@), this program sends temperature data to
@ -36,7 +36,7 @@ Sample output to serial when ``A`` button pressed:
{v:27,t:323,s:0}
```
### See also
## See also
[send number](/reference/radio/send-number),
[send value](/reference/radio/send-value),

View File

@ -8,7 +8,7 @@ Writes the data received by ``radio`` to serial in JSON format.
radio.writeValueToSerial();
```
### Data received format
## Data received format
The format for received data printed to serial is as follows:
@ -16,7 +16,7 @@ The format for received data printed to serial is as follows:
- [send value](/reference/radio/send-value): ```{v:ValueSent,t:MicrobitTimeAlive,s:SerialNumber,n:"Name"}```
- [send string](/reference/radio/send-string): ```{t:MicrobitTimeAlive,s:SerialNumber,n:"Text"}```
### Examples
## Examples
When ```radio``` data is received (after pressing the ``A`` button on
the second @boardname@), this program sends temperature data to
@ -36,7 +36,7 @@ Sample output to serial when ``A`` button pressed:
{v:27,t:323,s:0}
```
### See also
## See also
[send number](/reference/radio/send-number),
[send value](/reference/radio/send-value),