EV3 Ultrasonic Sensor¶
Non-Visible componentCategory | Requires | Version |
---|---|---|
LEGO® MINDSTORMS® > EV3 | API 21, Android 5.0 Lollipop | 2 |
Overview¶
A component that provides a high-level interface to an ultrasonic sensor on a LEGO MINDSTORMS EV3 robot.
Events¶
Above Range¶
Called when the detected distance has gone above the range.
Below Range¶
Called when the detected distance has gone below the range.
Within Range¶
Called when the detected distance has gone within the range.
Methods¶
Get Distance¶
Returns: Number
Returns the current distance in centimeters as a value between 0 and 254, or -1 if the distance can not be read.
Set CM Unit¶
Deprecated
Measure the distance in centimeters.
Set Inch Unit¶
Deprecated
Measure the distance in inches.
Properties¶
Above Range Event Enabled¶
Boolean Default: False Read Write - Designer Blocks
Whether the AboveRange event should fire when the distance goes above the TopOfRange.
Below Range Event Enabled¶
Boolean Default: False Read Write - Designer Blocks
Whether the BelowRange event should fire when the distance goes below the BottomOfRange.
Bluetooth Client¶
Component Read Write - Designer Blocks
The BluetoothClient component that should be used for communication.
Bottom Of Range¶
Number Default: 30 Read Write - Designer Blocks
The bottom of the range used for the BelowRange, WithinRange, and AboveRange events.
Sensor Port¶
Text Default: 1 Write - Designer
The sensor port that the sensor is connected to.
Top Of Range¶
Number Default: 90 Read Write - Designer Blocks
The top of the range used for the BelowRange, WithinRange, and AboveRange events.
Unit¶
Text Default: cm Read Write - Designer Blocks
Specifies the unit of distance.
Within Range Event Enabled¶
Boolean Default: False Read Write - Designer Blocks
Whether the WithinRange event should fire when the distance goes between the BottomOfRange and the TopOfRange.