Add the 'strength' option to the acceleration doc page. (#527)

This commit is contained in:
Galen Nickel 2017-09-05 17:10:54 -07:00 committed by Peli de Halleux
parent e49988f3d3
commit aa21545416

View File

@ -1,6 +1,6 @@
# Acceleration
Get the acceleration value (milli g-force), in one of three specified dimensions.
Get the acceleration value (milli g-force) in one of three dimensions, or the combined force in all directions.
Find the acceleration of the @boardname@ (how fast it is speeding up or slowing down).
@ -15,15 +15,17 @@ A **g** is as much acceleration as you get from Earth's gravity.
## ~
### Parameters
* ``dimension`` means which direction you are checking for acceleration, either `Dimension.X` (left and right), `Dimension.Y` (forward and backward), or `Dimension.Z` (up and down)
* **dimension**: the direction you are checking for acceleration, or the total strength of force.
>`x`: acceleration in the left and right direction.<br/>
`y`: acceleration in the forward and backward direction.<br/>
`z`: acceleration the up and down direction.<br/>
`strength`: the total of all the forces in every dimension (direction) together.
### 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`, and `z` is `-1023`.
* 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
@ -34,7 +36,16 @@ basic.forever(() => {
led.plotBarGraph(input.acceleration(Dimension.X), 1023)
})
```
### Example: quake meter
Every 5 seconds, with the @boardname@ facing upward on a flat surface, show how much the earth is shaking (if at all).
```blocks
basic.forever(() => {
basic.showNumber(input.acceleration(Dimension.Strength))
basic.pause(5000)
})
```
### See also