Unable to configurePin() and writeDigitalPin() for setting a UART device by Arduino MATLAB Support Package

4 次查看(过去 30 天)
Hi everyone,
I was working on my Arduino Uno rev3 board and trying to configure it to communicate with a UART sensor. The sensor required four pins for its multiplexor on Arduino which were D4 for Select 0 (S0), D5 for S1, D6 for S2, D7 for Enable. I have tested it on Arduino IDE before and it worked fine. As I wished to acquire data from the sensor and let MATLAB R2019b handle the processing task, I used the commands in MATLAB Support Package for Arduino. The package worked perfectly fine with another sensor that I previously used.
However I encountered a problem when I tried to set D7 as OUTPUT mode and write LOW to it. The error messege 'Unable to Retrieve Data from the Hardware' continued to appear until I unplugged the sensor. I have tried several times clearing the arduino object and reconnect the hardware really hard as the user guide of the Arduino MATLAB Support Package adviced, but it did not change. The wire connection were verified to be OK since it worked fine on Arduino IDE. Did anybody encounter similar problem and how did you solve it? Many thanks!
MATLAB.png

回答(1 个)

Bhaskar Vundurthy
This error might arise when the hardware is stuck while performing the I2C operation. Consider following the steps in the following link to successfully reflash the arduino server.
Alternatively, trace messages can be utilized to view the commands that are being executed on the hardware board. To view the trace messages, create the arduino object with the TraceOn parameter set as true and use sensor functions. Note that the TraceOn is not supported for read function.

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by