The current position is considered to be the horizon or a place that is the plane of reference (this is possibly someplace that’s flat for a horizontal reference).
reset
Reset the gyro sensor.
sensors.gyro2.reset()
To make the gyro measure rotation angle from the current position of the brick, it is recalibrated. That is, the brick’s current position is set to 0
degrees and rotation angle measurements start from there.
This function only resets the sensor; if you wish to have progress indication and a more robust calibration sequence, use calibrate.
Example
Set the brick on a flat surface. Reset gyro 2
and tilt the brick slightly. Reset it again while it’s still tilted. Lay the brick down flat again and display the angle measurement.
brick.buttonLeft.onEvent(ButtonEvent.Pressed, function () {
sensors.gyro2.reset()
})
forever(function() {
brick.showNumber(sensors.gyro2.angle(), 1)
})