MATLAB: How to debug MATLAB Support Package for Arduino with custom libraries

arduinocustomdebugMATLABtroubleshooting

I am using Arduino Uno and following this example-
while creating arduino object-
arduinoObj = arduino('COM3','Uno','Libraries','JRodrigoTech/UltrasonicDistanceStreamer','ForceBuild',true);
getting the error- ERROR: "Cannot program board Uno (COM8). Please make sure the board is supported and the port and board type are correct. For more information, see Arduino Hardware Troubleshooting."
How can I debug this?

Best Answer

To debug MATLAB Support package for Arduino for any possible error, use TraceOn. key-value pair.
First see if arduino object can be created without using custom libraries
Run the following command to see if this works fine-
>> a = arduino('COM8','Uno', 'TraceOn',true);
If this works fine, create ardunio object with custom library and have trace on-
>> arduinoObj = arduino('COM3','Uno','Libraries','JRodrigoTech/UltrasonicDistanceStreamer','ForceBuild',true, 'TraceOn',true);
This will give you debug information and upload errors of Arduino IDE at the MATLAB command window.