problem with ultrasonic toolbox for arduino

7 次查看(过去 30 天)
Hi everyone, I'm facing this problem where i want to use the ultrasonic library in matlab for interfacing with arduino but it doesn't seem to work . I have searched around the internet for hours and still cannot find the solution. I am really gonna very grateful for any suggestion.
thanks.
this is the result i get
a = arduino('COM3', 'Uno', 'Libraries', 'JRodrigoTech/HCSR04')
Updating server code on board Uno (COM3). Please wait.
Cannot program board Uno (COM3). Please make sure the board is supported and the port and board type are correct.

回答(2 个)

Vidip
Vidip 2023-11-23
I understand that you are facing an issue with programming the board or uploading the required code to the Arduino Uno. This could be due to several reasons like incorrect board type, incorrect COM port, for that you need to verify that the COM port specified in the ‘arduino’ function call (COM3 in this case) is the correct port to which the Arduino board is connected. You can check the COM port in the Arduino IDE or by using the ‘deviceinfo’ function in MATLAB.
You can go through the below documentation link to make sure you have established a proper connection between ultrasonic sensors and Arduino through MATLAB.
For further information, refer to the documentation link below:

MathWorks MATLAB Hardware Team
Hi,
You can use the following code to work with Ultrasonic sensor
>> arduinoObj = arduino('<COM PORT>','Uno',"Libraries","Ultrasonic")
>> ultrasonicObj = ultrasonic(arduinoObj,'<TRIG Pin>','<ECHO Pin>')
Refer to this link to know more,
https://in.mathworks.com/help/supportpkg/arduinoio/ref/arduinoio.ultrasonic.html?msclkid=73d5c767ae5911ec9f90682f469bce0c
Feel free to contact MathWorks Technical Support to get help on resolving any errors.
https://www.mathworks.com/support/contact_us.html
Thanks,
MATLAB Hardware Team
MathWorks

类别

Help CenterFile Exchange 中查找有关 Arduino Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by