How do I download the library for the HC-SR04 ultrasonic sensor into MATLAB?
45 次查看(过去 30 天)
显示 更早的评论
I've been trying to download the "HC-SR04 Add-On Library for Arduino" and I cannot figure out how to create a new library. I have been following the directions and comments at https://www.mathworks.com/matlabcentral/fileexchange/57898-hc-sr04-add-on-library-for-arduino closely, but the "JRodrigoTech/HCSR04" library won't show up.
My Code right now is:
%% Connect to Arduino
a=arduino('COM5','Uno','Libraries','JRodrigoTech/HCSR04')
%% Connect to Sensor
sensor=addon(a,'JRodrigoTech/HCSR04','11','12')
...and when I enter listArduinoLibraries, what I get is:
ans =
6×1 cell array
{'Adafruit/MotorShieldV2'}
{'I2C' }
{'RotaryEncoder' }
{'SPI' }
{'Servo' }
{'ShiftRegister' }
0 个评论
回答(1 个)
Madhu Govindarajan
2018-12-10
Try downloading from inside Add-On explorer. To do this -
1) Click on Add-Ons > Get Add-Ons from MATLAB toolstrip.
2) Search for this add-on and click on Add icon.
4) Unpackage the zip into local directory and rename the folder to ‘Ultrasonic’.
5) Move the ‘Ultrasonic’ folder into the "libraries" folder inside your Arduino sketchbook folder:
On Windows, the default path is "My Documents\Arduino\libraries\"
On Mac, the default path is "~/Documents/Arduino/libraries/"
On Linux, the default path is "/home/<username>/Arduino/libraries"
If this does not resolve the issue, try moving the Ultrasonic to the following location. To get the location,
1) Type winopen(arduinoio.IDERoot) in MATLAB.
2) Open Arduino IDE located here.
3) Click on Files > Preferences and note down the sketchbook location here.
4) Paste the Ultrasonic library in this location.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Setup and Configuration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!