How do I download the library for the HC-SR04 ultrasonic sensor into MATLAB?

43 vues (au cours des 30 derniers jours)
Dan Ostrander
Dan Ostrander le 9 Déc 2018
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' }

Réponses (1)

Madhu Govindarajan
Madhu Govindarajan le 10 Déc 2018
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.

Catégories

En savoir plus sur Setup and Configuration dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by