M5Stack fire gyro mpu6050
I just received my M5 Fire + m5bala this morning.
The M5 fire device is great. I played with M5 library with success (from Arduino) and managed to get some Hello world and other stuff running.
My problem is when I run the m5bala sample.
I did managed to compile and upload the sample, but the code won't work.
After some debugging, it appears that I can drive the motors correctly by setting manual commands.
However, the MPU6050 seems to be not responding as expected since I always have zero values.
Here is a piece of code I use to test the MPU. I tried different versions of MPU6050 library with no difference.
Any help is welcome, thank you.
// Power ON Stabilizing...
Wire.begin(); Wire.setClock(400000UL); // Set I2C frequency to 400kHz mpu6050.begin(); mpu6050.calcGyroOffsets(false); //mpu6050.setGyroOffsets(-2.70, -1.08, 0.87); M5.Lcd.setTextFont(2); M5.Lcd.setTextColor(TFT_WHITE, TFT_BLACK); M5.Lcd.println("M5Stack Balance Mode start");
M5.Lcd.printf("X: %f", mpu6050.getAngleX());
M5.Lcd.printf("Y: %f", mpu6050.getAngleY());
M5.Lcd.printf("Z: %f", mpu6050.getAngleZ());
// M5 Loop
Ok, it seems that the problem was due to my version of ESP32 tools.
I updated my ESP32 framework and now the code is working fine.
Also, I used PlatformIO in VSCode which make things simpler since it enables the M5STACK_FIRE flag during compilation.