Ultrasonic Sensor

Represent connected Ultrasonic sensor and measure distance to object

  • Library:
  • Simulink Coder Support Package for VEX EDR V5 Robot Brain / Sensors

Description

The Ultrasonic Sensor block represents an Ultrasonic Sensor that is connected to the 3-wire ports of VEX EDR V5 Robot Brain, and measure the distance to the object in the path of the robot. The block enables the object detection when the object is in the range of 3 to 300 centimeters (cm) from the sensor. The block outputs a value 0 for an object that is farther than 300 cm.

Ports

Output

expand all

The distance (in cm) as read from the Echo port of the Ultrasonic Sensor connected to VEX V5 Robot Brain.

Data Types: double

Parameters

expand all

Select the 3-wire port of VEX V5 Robot Brain to which the Echo port (output) of Ultrasonic sensor is connected. To know the output port, click the What is INPUT and OUTPUT? button.

After you select the OUTPUT (Echo port) in the block, the consecutive 3-wire port is assumed to be connected to the INPUT (Ping port) of the ultrasonic sensor. For example, if you select A as the OUTPUT (Echo port), it is assumed that B is connected to the INPUT (Ping) port of the ultrasonic sensor.

Enter the time interval at which the block reads values from the ultrasonic sensor.

When you set this parameter to -1, Simulink® determines the best sample time for the block based on the block context within the model.

Introduced in R2019b