Error when using HCSR04 example
13 次查看(过去 30 天)
显示 更早的评论
Using the HCSR04Example.m file only edited for the pins I am using on my Arduino Uno and COM3 instead of COM38 with Arduino hardware support and HC-SR04 Add-On Library for Arduino. I keep getting the error:
>> HCSR04Example
Updating server code on board Uno (COM3). Please wait.
Error using HCSR04Example (line 25)
The Arduino source 'Ultrasonic/Ultrasonic.h' for libraries 'JRodrigoTech/HCSR04' cannot be found. Install the 3P library source first and try again.
Have I not installed an add-on or not taken something else into account?
1 个评论
ayoub indjaren
2022-3-26
编辑:ayoub indjaren
2022-3-26
hi how are you , please can you help with this issue if you have found the solution
thinks
回答(4 个)
ameya umrani
2018-2-23
Even after installing the necessary libraries the error "The Arduino source 'Ultrasonic/Ultrasonic.h' for libraries 'JRodrigoTech/HCSR04' cannot be found. Install the 3P library source first and try again "still exists
1 个评论
ayoub indjaren
2022-3-26
hi how are you , please can you help with this issue if you have found the solution
thinks
ibra
2019-4-1
First download the file from this link
there is another file in the describtion, download it and put it in the arduino file in matlab
C:\ProgramData\MATLAB\SupportPackages\R2016b\3P.instrset\arduinoide.instrset\arduino-1.6.13/libraries
or type arduinoio.IDERoot in command window to see the directory of the file
if you get this error:
Cannot program board Uno (COMX). Please make sure the board is supported and the port and
board type are correct.
then rename the Arduino folder in Documents into anything else. and open the arduino.exe
from this folder (C:\ProgramData\MATLAB\SupportPackages\R2016b\3P.instrset\arduinoide.instrset\arduino-1.6.13/libraries)
you'll get this message "The sketchbook folder no longer exists. Arduino will switch to the default sketchbook location , and create a new sketchbook folder if necessary. Arduino will then stop talking about himself in the third person."
also it will help if you run matlab as an administrator
0 个评论
Hari Desanur
2016-11-14
Note that the HCSR04Example.m from the 'HC-SR04 Add-On Library for Arduino' requires MATLAB R2016a or higher and MATLAB Support Package for Arduino Hardware.
Make sure that the Arduino Support Package is installed correctly by running this command -
>> matlabshared.supportpkg.getInstalled
Ensure that you have followed the installation steps mentioned in this link such as renaming the unzipped folder to ‘Ultrasonic’.
Check if MATLAB is able to detect the add-on library by executing the "listArduinoLibraries" command. You may have to restart MATLAB after installing this library.
3 个评论
Jayanta Deb
2018-2-14
The sensor library doesnt work with 2015 version. It strongly recommends to use 2016 or higher version.
Arpita Agrawal
2018-2-23
Hi Ameya,
Please ensure that you have installed the 3P library of the Ultrasonic sensor from https://github.com/JRodrigoTech/Ultrasonic-HC-SR04/archive/master.zip
Refer to instruction on the doc page https://in.mathworks.com/matlabcentral/fileexchange/57898-hc-sr04-add-on-library-for-arduino to install this library.
Thanks Arpita
4 个评论
ayoub indjaren
2022-3-26
hi how are you , did you solve the problem sir because i'm stuck with it right now , any clue plz
Arpita Agrawal
2022-3-28
Hi Ayoub,
Hope you are doing well. Please note that the Legacy HC-SR04 Add-On Library for Arduino - File Exchange - MATLAB Central (mathworks.com) is supported only for R2016a-R2018b. If you are using MATLAB version R2019a and above, this functionality is integrated into MATLAB Support Package for Arduino Hardware. More information on connecting ultrasonic sensors with Arduino thru MATLAB from R2019a is available in Connection to ultrasonic sensor on Arduino hardware - MATLAB (mathworks.com).
I hope this helps. For further assistance, kindly reach out to MathWorks Technical Support.
Regards
Arpita
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Support Package for Arduino Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!