Represent connected Ultrasonic sensor and measure distance to object
Simulink Coder Support Package for VEX EDR V5 Robot Brain / Sensors
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.
Port_1— Distance read from the Echo port of the Ultrasonic sensor
The distance (in cm) as read from the Echo port of the Ultrasonic Sensor connected to VEX V5 Robot Brain.
OUTPUT (Echo port)— 3-wire port to which the Output port of Optical Shaft Encoder is connected
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
Sample time— Interval at which the block reads values
0.2(default) | any non-negative value that is a multiple of 0.2 | -1
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.