Merge branch 'master' of https://github.com/microsoft/pxt-microbit
This commit is contained in:
@ -30,4 +30,4 @@ input.onButtonPressed(Button.AB, () => {
|
||||
|
||||
## See also
|
||||
|
||||
[compassHeading](/reference/input/compass-heading)
|
||||
[compass heading](/reference/input/compass-heading)
|
||||
|
@ -56,10 +56,11 @@ basic.forever(() => {
|
||||
|
||||
## 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)
|
||||
(adjust itself). It will ask you to draw a circle by tilting the
|
||||
@boardname@.
|
||||
Every time you start to use the compass (for example, if you have just turned the @boardname@ on),
|
||||
the @boardname@ will start a [calibrate compass](/reference/input/calibrate-compass)
|
||||
(adjust itself).
|
||||
The [calibration step](https://support.microbit.org/support/solutions/articles/19000008874-calibrating-the-micro-bit-compass)
|
||||
will ask you to draw a fill pattern on the screen by tilting the @boardname@.
|
||||
|
||||
If you are calibrating or using the compass near metal, it might
|
||||
confuse the @boardname@.
|
||||
@ -78,4 +79,4 @@ input.onButtonPressed(Button.AB, () => {
|
||||
|
||||
## See also
|
||||
|
||||
[acceleration](/reference/input/acceleration), [calibrateCompass](/reference/input/calibrate-compass)
|
||||
[acceleration](/reference/input/acceleration), [calibrate compass](/reference/input/calibrate-compass)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Magnetic Force
|
||||
|
||||
Find the amount of magnetic force (the strength of a magnet) in the direction you say.
|
||||
Find the amount of magnetic force (the strength of a magnet) in one of the three directions.
|
||||
|
||||
```sig
|
||||
input.magneticForce(Dimension.X);
|
||||
@ -10,12 +10,14 @@ input.magneticForce(Dimension.X);
|
||||
|
||||
The @boardname@ measures magnetic force with **microteslas**.
|
||||
|
||||
## ~
|
||||
You are asked to [calibrate](https://support.microbit.org/support/solutions/articles/19000008874-calibrating-the-micro-bit-compass) the compass the first time run a program
|
||||
that uses the compass.
|
||||
|
||||
## ~
|
||||
|
||||
## Parameters
|
||||
|
||||
* ``dimension`` means which direction the @boardname@ should measure
|
||||
* **dimension**: this is the 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)
|
||||
@ -24,16 +26,14 @@ The @boardname@ measures magnetic force with **microteslas**.
|
||||
|
||||
* a [number](/types/number) of microteslas that means the strength of the magnet
|
||||
|
||||
## Example: metal detector
|
||||
## Example
|
||||
|
||||
This program makes the center LED of the @boardname@ get brighter when
|
||||
the magnetic force is stronger, and dimmer when it is weaker.
|
||||
Create a metal detector my measuring the strength of magnetic force in the `X` direction.
|
||||
Display a bar graph to show the current level of magnetic force measured by the magnetometer.
|
||||
|
||||
```blocks
|
||||
led.plot(2, 2)
|
||||
basic.forever(() => {
|
||||
let f = input.magneticForce(Dimension.X)
|
||||
led.setBrightness(f / 2000)
|
||||
basic.forever(function() {
|
||||
led.plotBarGraph(input.magneticForce(Dimension.X) / 2000, 0)
|
||||
})
|
||||
```
|
||||
|
||||
|
@ -1,18 +1,20 @@
|
||||
{
|
||||
"packages": {
|
||||
"approvedRepos": [
|
||||
"Microsoft/pxt-neopixel",
|
||||
"Microsoft/pxt-microturtle",
|
||||
"Microsoft/pxt-sonar",
|
||||
"Microsoft/pxt-hacking-stem",
|
||||
"Microsoft/pxt-bluetooth-temperature-sensor",
|
||||
"Microsoft/pxt-bluetooth-midi",
|
||||
"Microsoft/pxt-max6675",
|
||||
"Microsoft/pxt-midi",
|
||||
"Microsoft/pxt-radio-blockchain",
|
||||
"Microsoft/pxt-bluetooth-max6675",
|
||||
"Microsoft/pxt-filesystem",
|
||||
"Microsoft/pxt-ws2812b",
|
||||
"microsoft/pxt-neopixel",
|
||||
"microsoft/pxt-microturtle",
|
||||
"microsoft/pxt-sonar",
|
||||
"microsoft/pxt-hacking-stem",
|
||||
"microsoft/pxt-bluetooth-temperature-sensor",
|
||||
"microsoft/pxt-bluetooth-midi",
|
||||
"microsoft/pxt-max6675",
|
||||
"microsoft/pxt-midi",
|
||||
"microsoft/pxt-radio-blockchain",
|
||||
"microsoft/pxt-bluetooth-max6675",
|
||||
"microsoft/pxt-filesystem",
|
||||
"microsoft/pxt-ws2812b",
|
||||
"microsoft/pxt-apa102",
|
||||
"microsoft/pxt-radio-firefly",
|
||||
"KitronikLtd/pxt-kitronik-servo-lite",
|
||||
"KitronikLtd/pxt-kitronik-motor-driver",
|
||||
"KitronikLtd/pxt-kitronik-I2C-16-servo",
|
||||
|
Reference in New Issue
Block a user