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

@ -15,7 +15,7 @@ A **g** is as much acceleration as you get from Earth's gravity.
## ~
### Parameters
## Parameters
* **dimension**: the direction you are checking for acceleration, or the total strength of force.
>`x`: acceleration in the left and right direction.<br/>
@ -23,11 +23,11 @@ A **g** is as much acceleration as you get from Earth's gravity.
`z`: acceleration the up and down direction.<br/>
`strength`: the total of all the forces in every dimension (direction) together.
### Returns
## Returns
* a [number](/types/number) that means the amount of acceleration. When the @boardname@ is lying flat on a surface with the screen pointing up, `x` is `0`, `y` is `0`, `z` is `-1023`, and `strength` is `1023`.
### Example: bar chart
## Example: bar chart
This example shows the acceleration of the @boardname@ with a bar graph.
@ -47,7 +47,7 @@ basic.forever(() => {
})
```
### See also
## See also
[set accelerometer range](/reference/input/set-accelerometer-range),
[compass heading](/reference/input/compass-heading),

View File

@ -6,15 +6,15 @@ Check whether a button is pressed right now. The @boardname@ has two buttons: bu
input.buttonIsPressed(Button.A);
```
### Parameters
## Parameters
* ``button`` is a [String](/types/string). You should store `A` in it to check the left button, `B` to check the right button, or `A+B` to check both at the same time.
### Returns
## Returns
* [Boolean](/blocks/logic/boolean) that is `true` if the button you are checking is pressed, `false` if it is not pressed.
### Example
## Example
This program uses an [if](/blocks/logic/if) to run
one part of the program if the `A` button is pressed, and
@ -33,7 +33,7 @@ basic.forever(() => {
})
```
### See also
## See also
[on button pressed](/reference/input/on-button-pressed), [if](/blocks/logic/if), [forever](/reference/basic/forever)

View File

@ -6,7 +6,7 @@ Runs the compass calibration sequence.
input.calibrateCompass();
```
### Calibration
## Calibration
The calibration will ask you to draw a circle by tilting the
@boardname@.
@ -14,7 +14,7 @@ The calibration will ask you to draw a circle by tilting the
If you are calibrating or using the compass near metal, it might
confuse the @boardname@.
### Example
## Example
This example runs the calibration when the user presses **A+B** buttons.
@ -24,6 +24,6 @@ input.onButtonPressed(Button.AB, () => {
})
```
### See also
## See also
[compassHeading](/reference/input/compass-heading)

View File

@ -10,11 +10,11 @@ east, south, and west.
input.compassHeading();
```
### Returns
## Returns
* a [number](/types/number) from `0` to `360` degrees, which means the compass heading. If the compass isn't ready, it returns `-1003`.
### Example
## Example
This program finds the compass heading and stores it in the
`degrees` variable.
@ -23,14 +23,14 @@ This program finds the compass heading and stores it in the
let degrees = input.compassHeading()
```
### ~hint
## ~hint
When you run a program that uses this function in a browser, click and drag
the compass needle on the screen to change the compass heading.
### ~
## ~
### Example: compass
## Example: compass
This program finds the compass heading and then shows a letter
that means whether the @boardname@ is facing north (N), south (S),
@ -49,7 +49,7 @@ basic.forever(() => {
})
```
### Calibration
## Calibration
Every time you start to use the compass (for example, if you have just
turned the @boardname@ on), the @boardname@ will start to [calibrateCompass](/reference/input/calibrate-compass)
@ -59,7 +59,7 @@ turned the @boardname@ on), the @boardname@ will start to [calibrateCompass](/re
If you are calibrating or using the compass near metal, it might
confuse the @boardname@.
### ~ hint
## ~ hint
Keep the calibration handy by running it when the user pressed **A+B**.
@ -69,8 +69,8 @@ input.onButtonPressed(Button.AB, () => {
})
```
### ~
## ~
### See also
## See also
[acceleration](/reference/input/acceleration), [calibrateCompass](/reference/input/calibrate-compass)

View File

@ -14,11 +14,11 @@ has to be turned on first.
input.lightLevel();
```
### Returns
## Returns
* a [Number](/types/number) that means a light level from ``0`` (dark) to ``255`` (bright).
### Example: show light level
## Example: show light level
When you press button `B` on the microbit, this
program shows the light level
@ -31,7 +31,7 @@ input.onButtonPressed(Button.B, () => {
})
```
### Example: chart light level
## Example: chart light level
This program shows the light level with a [bar chart](/reference/led/plot-bar-graph) on the @boardname@ screen.
If you carry the @boardname@ around to different places with different light levels,
@ -43,7 +43,7 @@ basic.forever(() => {
})
```
### See also
## See also
[acceleration](/reference/input/acceleration), [compass-heading](/reference/input/compass-heading)

View File

@ -13,18 +13,18 @@ The @boardname@ measures magnetic force with **microteslas**.
## ~
### Parameters
## Parameters
* ``dimension`` means which direction the @boardname@ should measure
magnetic force in: either `Dimension.X` (the left-right direction),
`Dimension.Y` (the forward/backward direction), or `Dimension.Z`
(the up/down direction)
### Returns
## Returns
* a [number](/types/number) of microteslas that means the strength of the magnet
### Example: metal detector
## Example: metal detector
This program makes the center LED of the @boardname@ get brighter when
the magnetic force is stronger, and dimmer when it is weaker.
@ -37,6 +37,6 @@ basic.forever(() => {
})
```
### See also
## See also
[compass heading](/reference/input/compass-heading)

View File

@ -12,7 +12,7 @@ on the @boardname@.
input.onButtonPressed(Button.A, () => {})
```
### Example: count button clicks
## Example: count button clicks
This example counts how many times you press the `A` button.
Each time you press the button, the [LED screen](/device/screen) shows the `count` variable getting bigger.
@ -26,7 +26,7 @@ input.onButtonPressed(Button.A, () => {
})
```
### Example: roll dice
## Example: roll dice
This example shows a number from 1 to 6 when you press the `B` button.
@ -37,14 +37,14 @@ input.onButtonPressed(Button.B, () => {
})
```
### ~hint
## ~hint
This program adds a `1` to `random(6)` so the numbers on the dice will come out right.
Otherwise, sometimes they would show a `0`.
### ~
## ~
### See also
## See also
[button is pressed](/reference/input/button-is-pressed), [forever](/reference/basic/forever), [random](/blocks/math)

View File

@ -9,11 +9,11 @@ input.onGesture(Gesture.Shake,() => {
})
```
### Parameters
## Parameters
* ``gesture`` means the way you hold or move the @boardname@. This can be `shake`, `logo up`, `logo down`, `screen up`, `screen down`, `tilt left`, `tilt right`, `free fall`, `3g`, or `6g`.
### Example: random number
## Example: random number
This program shows a number from `0` to `9` when you shake the @boardname@.

View File

@ -29,7 +29,7 @@ instead of the USB cable.
* ``name`` means the pin that is being pressed, either `P0`, `P1`, or `P2`
### Example: pin pressed counter
## Example: pin pressed counter
This program counts how many times you press the `P0` pin.
Every time you press the pin, the program shows the number of times on the screen.
@ -43,7 +43,7 @@ input.onPinPressed(TouchPin.P0, () => {
})
```
### See also
## See also
[@boardname@ pins](/device/pins), [pin is pressed](/reference/input/pin-is-pressed), [analog read pin](/reference/pins/analog-read-pin), [analog write pin](/reference/pins/analog-write-pin), [digital read pin](/reference/pins/digital-read-pin), [digital write pin](/reference/pins/digital-write-pin)

View File

@ -28,7 +28,7 @@ instead of the USB cable.
* ``name`` means the pin that is being released, either `P0`, `P1`, or `P2`
### Example: pin pressed counter
## Example: pin pressed counter
This program counts how many times you release the `P0` pin.
Every time you release the pin, the program shows the number of times on the screen.
@ -42,7 +42,7 @@ input.onPinReleased(TouchPin.P0, () => {
})
```
### See also
## See also
[@boardname@ pins](/device/pins), [pin is pressed](/reference/input/pin-is-pressed), [analog read pin](/reference/pins/analog-read-pin), [analog write pin](/reference/pins/analog-write-pin), [digital read pin](/reference/pins/digital-read-pin), [digital write pin](/reference/pins/digital-write-pin)

View File

@ -17,15 +17,15 @@ instead of the USB cable.
## ~
### Parameters
## Parameters
* a [string](/types/string) that holds the pin name (**P0**, **P1**, or **P2**)
### returns
## returns
* a [boolean](/blocks/logic/boolean) that means whether the pin you say is pressed (`true` or `false`)
### Example
## Example
This program shows `1` if `P0` is pressed, and `0` if `P0` is not pressed:
@ -39,7 +39,7 @@ basic.forever(() => {
})
```
### See also
## See also
[@boardname@ pins](/device/pins), [on pin pressed](/reference/input/on-pin-pressed), [analog read pin](/reference/pins/analog-read-pin), [analog write pin](/reference/pins/analog-write-pin), [digital read pin](/reference/pins/digital-read-pin), [digital write pin](/reference/pins/digital-write-pin)

View File

@ -13,15 +13,15 @@ check how the @boardname@ is moving.
## ~
### Parameters
## Parameters
* ``kind`` means which direction you are checking: `Rotation.Pitch` (up and down) or `Rotation.Roll` (left and right)
### Returns
## Returns
* a [number](/types/number) that means how much the microbit is tilted in the direction you say, from `0` to `360` degrees
### Example: @boardname@ leveler
## Example: @boardname@ leveler
This program helps you move the @boardname@ until it is level. When
it is level, the @boardname@ shows a smiley.
@ -55,7 +55,7 @@ basic.forever(() => {
});
```
### See also
## See also
[acceleration](/reference/input/acceleration), [compass-heading](/reference/input/compass-heading)

View File

@ -6,12 +6,12 @@ Find how long it has been since the program started.
input.runningTime();
```
### Returns
## Returns
* the [Number](/types/number) of milliseconds since the program started.
(One second is 1000 milliseconds.)
### Example: elapsed time
## Example: elapsed time
When you press button `B` on the microbit, this
program finds the number of milliseconds since the program started
@ -25,7 +25,7 @@ input.onButtonPressed(Button.B, () => {
```
### See also
## See also
[show number](/reference/basic/show-number), [pause](/reference/basic/pause)

View File

@ -9,14 +9,14 @@ or low acceleration.
input.setAccelerometerRange(AcceleratorRange.OneG);
```
### Parameters
## Parameters
* ``range`` means the biggest number of gravities of acceleration you
will be measuring (either `1g`, `2g`, `4g`, or `8g`). Any bigger numbers
will be ignored by your @boardname@, both when you are picking a
number of gravities, and when you are measuring acceleration.
### Example
## Example
This program sets the highest acceleration that your @boardname@
will measure is 4G. Then it shows acceleration from side to side
@ -29,13 +29,13 @@ basic.forever(() => {
});
```
#### ~hint
### ~hint
This program does not work in the simulator, only in a @boardname@.
#### ~
### ~
### See Also
## See Also
[compass heading](/reference/input/compass-heading),
[light level](/reference/input/light-level)

View File

@ -7,18 +7,18 @@ The @boardname@ can find the temperature nearby by checking how hot its computer
input.temperature();
```
### Returns
## Returns
* a [Number](/types/number) that means the Celsius temperature.
### How does it work?
## How does it work?
The @boardname@ checks how hot its CPU (main computer chip) is.
Because the @boardname@ does not usually get very hot, the temperature of the CPU
is usually close to the temperature of wherever you are.
The @boardname@ might warm up a little if you make it work hard, though!
### Example: @boardname@ thermometer
## Example: @boardname@ thermometer
The following example uses `temperature` and `show number` to show the temperature of the room.
@ -28,7 +28,7 @@ basic.forever(() => {
basic.showNumber(temp)
})
```
### Example: Fahrenheit thermometer
## Example: Fahrenheit thermometer
This program measures the temperature using Fahrenheit degrees.
Fahrenheit is a way of measuring temperature that is commonly used in the United States.
@ -43,16 +43,16 @@ basic.forever(() => {
})
```
### ~hint
## ~hint
Try comparing the temperature your @boardname@ shows to a real thermometer in the same place.
You might be able to figure out how much to subtract from the number the @boardname@
shows to get the real temperature. Then you can change your program so the @boardname@ is a
better thermometer.
### ~
## ~
### See also
## See also
[compass-heading](/reference/input/compass-heading), [acceleration](/reference/input/acceleration)