Set Accelerometer Range

Set up the part of the Calliope mini that measures acceleration (how much the microbit is speeding up or slowing down), in case you need to measure high or low acceleration.

input.setAccelerometerRange(AcceleratorRange.OneG);

Parameters

Example

This program says the highest acceleration that your Calliope mini will measure is 4G. Then it measures acceleration from side to side until you stop the program.

input.setAccelerometerRange(AcceleratorRange.FourG);
basic.forever(() => {
    basic.showNumber(input.acceleration(Dimension.X));
});

This program does not work in the simulator, only in a Calliope mini.

See Also

compass heading, light level

Edit this page on GitHub