MATLAB: No Add-On Library Uploaded to Board Arduino UNO

46 次查看(过去 30 天)
Hey guys.
So, I have no idea why this code isn't working, and I have a massive headache from it lol. Just trying to do the simple "Mapping Your Surroundings" kiddie project from Mathworks and the code simply won't work. I get the error message:
"No add-on library uploaded to the board. Clear and recreate the current arduino object to include the appropriate library. For a list of available libraries, type 'listArduinoLibraries'."
I have the Arduino Support Package installed. That's all I should need according to the guide, I believe. I changed the code to fit with the newest version, yet nothing. Help me out here haha, code:
a = arduino('COM3', 'Uno' , 'Libraries' , {'Ultrasonic' , 'Servo'} ) ;
ultrasonic = addon(a, 'Ultrasonic' , 'D12', 'D13' );
servo_motor = servo(a, 'D3');
That's all the code before it stops haha, no clue what's going on. Any help is appreciated!

采纳的回答

Rohan Kale
Rohan Kale 2021-11-30
Hi Garth,
If you are using MATLAB version R2019a or beyond, the Ultrasonic library is already integrated with the support package and you can directly use the ultrasonic constructor to create Ultrasonic object -
>> u = ultrasonic(a, 'D12', 'D13'); % for R2019a or beyond
Refer to the ultrasonic documentation page at -
For versions R2018b or earlier, you will require to install the HC-SR04 addon-library from
and use the addon workflow to create the Ultrasonic addon object -
>> u = addon(a, 'JRodrigoTech/HCSR04', 'D12', 'D13'); % for R2018b or earlier

更多回答(0 个)

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by