where to set the offset code of the MPU in S-function builder ?

2 次查看(过去 30 天)
i downloaded a ready S-function of MPU 6050 from this link: https://minseg.webs.com/arduino-downloads and i'm using a trial version R2018a. in the s-function, there's a part of libraries part of Update pane
Wire.begin();
accelgyro.initialize();
part of output pane
x_vel[0]=accelgyro.getRotationX();
y_vel[0]=accelgyro.getRotationY();
z_vel[0]=accelgyro.getRotationZ();
x_acc[0]=accelgyro.getAccelerationX();
y_acc[0]=accelgyro.getAccelerationY();
z_acc[0]=accelgyro.getAccelerationZ();
i wanted to add setoffset() because my MPU give me wrong values
accelgyro.setXAccelOffset(-917);
accelgyro.setYAccelOffset(-1479);
accelgyro.setZAccelOffset(1380);
accelgyro.setXGyroOffset(-2944);
accelgyro.setYGyroOffset(-18);
accelgyro.setZGyroOffset(-6);
i put it in different panes start, output and update but it still give me wrong values. i didn't know what to do.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Support Package for Arduino Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by