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

2 views (last 30 days)
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.

Answers (0)

Categories

Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!