Matlab安装Arduino函数库HC-SR04

Matlab安装Arduino函数库HC-SR04

这个官网给出的教程存在瑕疵HC-SR04 Add-On Library for Arduino,但还是能解决问题的。我是先在官网下的工具箱HCSR04_Add-On_Library_for_Arduino.mltbx,(如何安装)安装之后发现会报错,然后根据评论里的大佬的留言:到github上下载了一个文件,把解压后放到目录:

C:\MATLAB\SupportPackages\R2016a\arduino-1.6.1\libraries或者C:\Documents\Arduino\libraries

然后就可以使用了。

大佬原话如下:

Hi!

For all those who have downloaded and installed all the libraries but still cannot get their arduino board to work, follow the steps below. Skip those you’ve done already.

-install arduino support package for matlab.

-install arduino support package for simulink.

-download the hcsro4 arduino library from the link below

https://github.com/JRodrigoTech/Ultrasonic-HC-SR04/archive/master.zip

-extract the zip to Documents\Arduino\libraries" and rename it to ‘Ultrasonic’.

Note: if the exracted folder has two folder levels then you must delete one. see the paths below;

Correct path:

“Documents\Arduino\libraries\Ultrasonic”. then you see the “. h” file,…

Wrong path:

Documents\Arduino\libraries\Ultrasonic\Ultrasonic".

参考以下:

https://ww2.mathworks.cn/matlabcentral/fileexchange/57898-hc-sr04-add-on-library-for-arduino?s_tid=srchtitle

https://blog.csdn.net/majun1259389904/article/details/54773397