if your device was build-in MPU6886. it use the ''balance loop" will be reverse direction. so , maybe you can use the Arduino Example Github LInk: https://github.com/m5stack/M5Stack/tree/master/examples/Modules/Bala