HC-SR04 Add-On Library for Arduino not working
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Devansh Mittal
am 15 Apr. 2018
Kommentiert: Muhammad Hilmi Al Farid Ni'man
am 9 Jan. 2021
I am using MATLAB 2018a. I have followed all the instructions mentioned in https://in.mathworks.com/matlabcentral/fileexchange/57898-hc-sr04-add-on-library-for-arduino
I have even downloaded the zip file, renamed it to 'Ultrasonic' and put it in "My Documents\Arduino\libraries\"
However, when I run the command "arduino('COM8', 'Uno', 'Libraries', 'JRodrigoTech/HCSR04')", I get the 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."
But when I just run the arduino() command in the command window, I get the required object
Port: 'COM8'
Board: 'Uno'
AvailablePins: {'D2-D13', 'A0-A5'}
Libraries: {'I2C', 'Servo', 'SPI'}
Can someone please help me with this?
0 Kommentare
Antworten (2)
Madhu Govindarajan
am 17 Apr. 2018
For these addons to work there are two requirements -
1) You place the 3P libraries in the accurate folder - C:\ProgramData\MATLAB\SupportPackages\R2018a\3P.instrset\arduinoide.instrset\arduino-1.8.1\libraries
If you did not install your support package in the default - C:\ProgramData\MATLAB\SupportPackages\R2018a\ then you can find out where it is located by typing the following command in MATLAB.
>> matlabshared.supportpkg.getSupportPackageRoot
Here, confirm that you are placing the 3P libraries in one direct folder. Example - sometimes it gets located inside /libraries/UltraSonic/UltraSonic and this can cause issues as the HCSR04.m file is looking at /libraries/UltraSonic folder.
2) Make sure that the downloaded zip file is on MATLAB path and that you have not renamed the +arduinoioaddons,+JRodrigoTech folders.
Once you have both of these, if you type the following in MATLAB Command Window
>> listArduinoLibraries
This should show your library. If it does not please post the output for others to help.
Madhu
PS - If this works, please accept the answer. I say this because this is a commonly asked question for 3P addons, and I want to see if this solution works universally for all addons.
2 Kommentare
Vinesh Appu
am 29 Aug. 2020
Hi, i did what ever you told but i am getting error
"Cannot program board Uno (COM9). Please make sure the board is supported and the port and board type are
correct. For more information, see Arduino Hardware Troubleshooting."
please help me
Kohl Fritschen
am 3 Mai 2019
Adding the JRodrigoTech/HCSR04 addon file to the C:\ProgramData\MATLAB\SupportPackages\R2018b\3P.instrset path allowed my arduino Uno to recognize the library and create the object
a = arduino('COM3', 'Uno', 'Libraries', 'JRodrigoTech/HCSR04')
0 Kommentare
Siehe auch
Kategorien
Mehr zu MATLAB Support Package for Arduino Hardware finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!