This example shows how you can use MATLAB® scripts to implement more complex functionality for your LEGO® MINDSTORMS® EV3™ hardware. It shows you how to write a MATLAB script to implement a collision alarm with LEGO MINDSTORMS EV3 hardware.
You can use the MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware to interact with LEGO MINDSTORMS EV3 hardware from within MATLAB. Using a basic MATLAB script, you can build complex systems with the LEGO MINDSTORMS EV3 brick.
In this example, you can follow step-by-step instructions for creating a collision alarm implementation with the EV3 brick and Ultrasonic sensor. As an object gets closer to the Ultrasonic sensor, the EV3 brick generates a higher-pitched alarm sound.
See the example for step-by-step instructions: https://www.mathworks.com/examples/matlab/4351-build-a-collision-alarm-using-the-ev3-ultrasonic-sensor