Class EV3UltrasonicSensor

    • Constructor Detail

      • EV3UltrasonicSensor

        public EV3UltrasonicSensor​(Port port)
        Create the Ultrasonic sensor class.
        Parameters:
        port -
      • EV3UltrasonicSensor

        public EV3UltrasonicSensor​(UARTPort port)
        Create the Ultrasonic sensor class.
        Parameters:
        port -
    • Method Detail

      • init

        protected void init()
      • getListenMode

        public SampleProvider getListenMode()
        Lego EV3 Ultrasonic sensor, Listen mode
        Listens for the presence of other ultrasonic sensors.

        Size and content of the sample
        The sample contains one elements indicating the presence of another ultrasonic sensor. A value of 1 indicates that the sensor detects another ultrasonic sensor.

        Returns:
        A sampleProvider
      • getDistanceMode

        public SampleProvider getDistanceMode()
        Lego EV3 Ultrasonic sensor, Distance mode
        Measures distance to an object in front of the sensor

        Size and content of the sample
        The sample contains one elements representing the distance (in metres) to an object in front of the sensor. unit).

        Returns:
        A sampleProvider
      • enable

        public void enable()
        Enable the sensor. This puts the indicater LED on.
      • disable

        public void disable()
        Disable the sensor. This puts the indicater LED off.
      • isEnabled

        public boolean isEnabled()
        Indicate that the sensor is enabled.
        Returns:
        True, when the sensor is enabled.
        False, when the sensor is disabled.