![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/178144/image.png)
Mapping objects on a table onto MATLAB grid using HC-SR04 ultrasonic sensors with Arduino
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi everybody,
I'm using an HC-SR04 ultrasonic sensor with Arduino to detect objects on a table and have it "plot" that detection on a grid.
I essentially want to "map" objects it detects on the table onto a grid in MATLAB. I am not using a servo motor to rotate the ultrasonic sensor. I am only detecting objects that are right in front of it in its line of sight.
I started off with an arbitrary grid:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166982/image.png)
I was thinking of representing each object that I find on the table as a block that's "shaded" in.
The general idea of how I want to do this is to have an ultrasonic sensor detect an object and then have it populate a "block" of the grid.
댓글 수: 0
답변 (1개)
Kris Fedorenko
2017년 9월 6일
Hi Ammar,
If I understand your question correctly, you would like to be able to represent detected objects as a grid. I think you should consider using heatmap. Here is a simple example:
objects = zeros(10, 10);
objects(3, 4) = 1;
objects(5, 8) = 1;
heatmap(objects)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/178144/image.png)
Hope this helps!
Kris
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Device Driver Blocks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!