pxt-calliope/docs/reference/input/calibrate-compass.md
Peli de Halleux bd895f43ba Calibrate compass (#392)
* adding 'calibrate-compass' function

* fixing simulator.

* updated docs

* fixing compat test suite with 'calibrate()' function
2017-04-25 10:46:25 -07:00

30 lines
523 B
Markdown

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