diff --git a/docs/reference/input/acceleration.md b/docs/reference/input/acceleration.md index f4b4e122..f59ffa62 100644 --- a/docs/reference/input/acceleration.md +++ b/docs/reference/input/acceleration.md @@ -38,5 +38,7 @@ basic.forever(() => { ### See also -[compass-heading](/reference/input/compass-heading), [lightlevel](/reference/input/light-level) +[set accelerometer range](/reference/input/set-accelerometer-range), +[compass heading](/reference/input/compass-heading), +[light level](/reference/input/light-level) diff --git a/docs/reference/input/set-accelerometer-range.md b/docs/reference/input/set-accelerometer-range.md new file mode 100644 index 00000000..68589749 --- /dev/null +++ b/docs/reference/input/set-accelerometer-range.md @@ -0,0 +1,37 @@ +# Set Accelerometer Range + +Set up the part of the micro:bit that measures +[acceleration](/reference/input/acceleration) (how much the microbit +is speeding up or slowing down), in case you need to measure high +or low acceleration. + +### Parameters + +* 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 micro:bit, both when you are picking a number of + gravities, and when you are measuring acceleration. + +### Example + +This program says the highest acceleration that your micro:bit +will measure is 4G. Then it measures acceleration from side to side +until you stop the program. + +```blocks +input.setAccelerometerRange(AcceleratorRange.FourG); +basic.forever(() => { + basic.showNumber(input.acceleration(Dimension.X)); +}); +``` + +#### ~hint + +This program does not work in the simulator, only in a micro:bit. + +#### ~ + +### See Also + +[compass heading](/reference/input/compass-heading), +[light level](/reference/input/light-level)