Learn how to use MATLAB and Arduino to map your surroundings. By rotating an ultrasonic sensor on a servo motor, MATLAB is able to display the location of any obstacle in a given environment.
HC-SR04 Ultrasonic Sensor
USB A to B Cable
Dan Doherty (2021). Mapping Your Surroundings Using MATLAB and Arduino (https://www.mathworks.com/matlabcentral/fileexchange/58434-mapping-your-surroundings-using-matlab-and-arduino), MATLAB Central File Exchange. Retrieved .
Here are some changes I made in the code to make it work in Matlab R2020a:
-Change the 'JRodrigoTech/HCSR04' library into 'Ultrasonic' (line 5)
-Change the sensor function into ultrasonic and remove the library parameter (line 8)
-Change the readTravelTime function into readDistance (lines 18, 20, 32, 34)
Can we change the Digital pin defined in Matlab script to any other pin of Arduino or it is not possible with the current libraries?
can the servo motor runs continuously???
can i use this in arduino mega 2560???
The Arduino source 'Ultrasonic/Ultrasonic.h' for libraries 'JRodrigoTech/HCSR04' cannot be found.
Install the 3P library source first and try again.
What am I supposed to do in order to make it work?
Where can i find the code?
Help me!Error using HCSR04Example (line 25)
Cannot program board Uno (COM4). Please make sure the board is supported and the port and board
type are correct.
Thak you very much that is a great project. I'm having the following error in the code: Cannot program board Uno (COM3). Please make sure the board is supported and the port and board type are correct.' I'll appreciate any help.
Great job guys putting this together. Looking forward to see the rest of the projects. Is there a tag that we all can filter through to look at these new examples?
Inspired by: Legacy HC-SR04 Add-On Library for Arduino
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!