2017-04-25 19:46:25 +02:00
|
|
|
# Calibrate Compass
|
|
|
|
|
|
|
|
Runs the compass calibration sequence.
|
|
|
|
|
|
|
|
```sig
|
|
|
|
input.calibrateCompass();
|
|
|
|
```
|
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## Calibration
|
2017-04-25 19:46:25 +02:00
|
|
|
|
2017-10-16 07:27:09 +02:00
|
|
|
The calibration will ask you to draw a circle or fill the LED screen by tilting the
|
2017-04-25 19:46:25 +02:00
|
|
|
@boardname@.
|
|
|
|
|
|
|
|
If you are calibrating or using the compass near metal, it might
|
|
|
|
confuse the @boardname@.
|
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## Example
|
2017-04-25 19:46:25 +02:00
|
|
|
|
|
|
|
This example runs the calibration when the user presses **A+B** buttons.
|
|
|
|
|
|
|
|
```blocks
|
|
|
|
input.onButtonPressed(Button.AB, () => {
|
|
|
|
input.calibrateCompass();
|
|
|
|
})
|
|
|
|
```
|
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## See also
|
2017-04-25 19:46:25 +02:00
|
|
|
|
|
|
|
[compassHeading](/reference/input/compass-heading)
|