Plotting output of three MPU6050 sensors in Matlap in three different graphes

20 ビュー (過去 30 日間)
Marvikov
Marvikov 2019 年 6 月 14 日
回答済み: Gayatri Menon 2022 年 1 月 7 日
Hey guys.
I want to plot my programming code from the arduino/teensy in matlab to see the real time data in a diagram. So what I already have now is the programm code to read out the values of three MPU6050 sensores as a change of the angle in x-, y- and z-axis.
So, now I would like to plot three different diagrams for each axis. And in every diagram, there should be all the three sensors over the time. I am not really used to Matlab workspace, so I would like to get some help here.
I am thankful for every kind of help! :)
  1 件のコメント
Ajwad Wa'ie
Ajwad Wa'ie 2019 年 12 月 1 日
Bro if you don’t mind, can you share the code for three mpu-6050 on Arduino, because I got the same problem as you

サインインしてコメントする。

回答 (1 件)

Gayatri Menon
Gayatri Menon 2022 年 1 月 7 日
Hi,
For Arduino board, you could use mpu6050() to connect MPU6050 sensor
a = arduino;
imu = mpu6050(a);
xlabel('Count');
ylabel('Acceleration (m/s^2)');
title('Acceleration values from mpu6050 sensor');
x_val = animatedline('Color','r');
y_val = animatedline('Color','g');
z_val = animatedline('Color','b');
axis tight;
legend('Acceleration in X-axis','Acceleration in Y-axis','Acceleration in Z-axis');
stop_time = 100;
count = 1;
tic;
while(toc <= stop_time)
[accel] = readAcceleration(imu);
addpoints(x_val,count,accel(:,1));
addpoints(y_val,count,accel(:,2));
addpoints(z_val,count,accel(:,3));
count = count + 1;
drawnow limitrate;
end
For more help
For more help refer MPU6050 - Arduino
or
execute
>>help mpu6050
Hope this helps
Thanks
Gayatri

カテゴリ

Help Center および File ExchangeI2C Devices についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by