How to update values from I2C in Simulink using Arduino hardware for the MMA8541 Accelerometer

4 visualizaciones (últimos 30 días)
I have followed the tutorial listed on to connect my MMA8541 Accelerometer to an Arduino Uno using Simulink. Iunderstand that the board in the tutorial is different, but I doubt that is the problem, as it should work in a similar fashion: https://ww2.mathworks.cn/help/supportpkg/freedomboard/examples/read-acceleration-data-from-the-onboard-mma8451q-3-axis-digital-accelerometer-via-i2c.html
Unfortunately, no matter how much i research and try various things, I cannot manage to get it to work. This is what my "main" simulink block looks like:
The board I am using is the Arduino Uno. I am trying to connect it using I2C. When I do so, no error shows, I this is what i see when I execute the .slx file:
My read configuration:
The output I get stays the same, it doesn't change one bit... Could someone please help me? Ii attached the file below just in case

Respuestas (1)

Nagasai Bharat
Nagasai Bharat el 28 de Sept. de 2020
Hi,
As the tutorial is given for the onboard accelerometer and the hardware architecture for FRDM Board would be different from Arduino Uno and hence leading to the issue.
Try going through the datasheet for the accelerometer you are using and get the registers right.
Try the model in the above model as it could be of some help.
  1 comentario
Joncikas
Joncikas el 28 de Sept. de 2020
Thank you for your reply :)
Unfortunately I have attempted that code with no success... I tried it on the 2020a version, as well as the 2019b version. It should work, but it doesn't. I get values, buty they stay the same hroughout, even though I tilt the MMA8451 board back and forth...

Iniciar sesión para comentar.

Categorías

Más información sobre Modeling en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by