sonicSensor
Connection to ultrasonic sensor
Description
This object represents a connection to an EV3 Ultrasonic Sensor (item number 45504). To measure the distance from the sensor to an object in meters, use this object with thereadDistance
function.
Creation
Description
creates a connection to a ultrasonic sensor. You can use this connection with themysonicsensor
= sonicSensor(myev3
)readDistance
function to measure the distance from an ultrasonic sensor to an object.
If multiple ultrasonic sensors are attached to the EV3 brick, this function chooses the sensor that is attached to the EV3 input port with the lowest number.
creates a connection to an ultrasonic sensor that uses a specific EV3 input port defined by theInputPortproperty.mysonicsensor
= sonicSensor(myev3
,inputport)
Input Arguments
Output Arguments
Properties
Object Functions
readDistance |
Read distance from ultrasonic sensor to object |