Plotting output of three MPU6050 sensors in Matlap in three different graphes
22 次查看(过去 30 天)
显示 更早的评论
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
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
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
or
execute
>>help mpu6050
Hope this helps
Thanks
Gayatri
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Arduino Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!