MATLAB Answers

Arduino Connection Issue with addon

10 views (last 30 days)
Jordan Conte
Jordan Conte on 23 Jan 2021
Answered: Saurav Chaudhary on 27 Jan 2021
I am currently using an arduino with the motorshield v2 to drive a few stepper motors for my 3d printer. when I boot up matlab, I usually start by programming the arduino which completes successfully, I test the connection which also is successful. however, when I run my code I get this error message and cant figure out what could be causing it. I have tried redownloading the arduino addon, and clearing the object in the workspace but cant figure it out. sometimes it will persist for hours before I can get my code to run. I am even able to program successfully using the Arduino IDE, meaning i dont believe it is hardware related. Ive atatched screenshots
hoping someone can help!

  0 Comments

Sign in to comment.

Answers (1)

Saurav Chaudhary
Saurav Chaudhary on 27 Jan 2021
Refer the following documentation link which states how you can perform troubleshooting steps when you get the error "Unable to receive data from the target hardware".
If you continue to face the issue with IMU sensors, it is likely that it is due to the loose connections between the sensor and Arduino board. This causes the code to get stuck while performing the I2C operation.
Also, Trace messages can be used to view the commands which are being executed on the hardware board when you are using sensor functions. To view the trace messages, create the arduino object with the TraceOn parameter set as true and use sensor functions.

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by