M5Stack fire gyro mpu6050
-
Hello,
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.Regards
#include <M5Stack.h>
#include <MPU6050_tockn.h>
#include <Wire.h>MPU6050 mpu6050(Wire);
void setup()
{
// Power ON Stabilizing...
delay(500);
M5.begin();
M5.setPowerBoostKeepOn(false);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");}
void loop()
{
mpu6050.update();
M5.Lcd.clear();
M5.Lcd.setCursor(0, 0);
M5.Lcd.printf("X: %f", mpu6050.getAngleX());
M5.Lcd.setCursor(0, 20);
M5.Lcd.printf("Y: %f", mpu6050.getAngleY());
M5.Lcd.setCursor(0, 40);
M5.Lcd.printf("Z: %f", mpu6050.getAngleZ());
delay(500);
// M5 Loop
M5.update();
} -
This post is deleted! -
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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login