Class NXTLightSensor

    • Constructor Detail

      • NXTLightSensor

        public NXTLightSensor​(AnalogPort port)
        Create a light sensor object attached to the specified port. The sensor will be set to floodlight mode, i.e. the LED will be turned on.
        Parameters:
        port - port, e.g. Port.S1
      • NXTLightSensor

        public NXTLightSensor​(Port port)
        Create a light sensor object attached to the specified port. The sensor will be set to floodlight mode, i.e. the LED will be turned on.
        Parameters:
        port - port, e.g. Port.S1
    • Method Detail

      • init

        protected void init()
      • setFloodlight

        public void setFloodlight​(boolean floodlight)
        Description copied from interface: LampController
        Turns the default LED light on or off. If the sensor has more than one lamp color, this will control the red LED.
        Specified by:
        setFloodlight in interface LampController
        Parameters:
        floodlight - true to turn on lamp, false for off (ambient light only).
      • setFloodlight

        public boolean setFloodlight​(int color)
        Description copied from interface: LampController
        Used to turn on or off the floodlight by color. If the sensor has multiple light colors, you can control which color is turned on or off. If the color does not exist, it does nothing and returns false. You can turn the floodlight off by using Color.NONE.
        Specified by:
        setFloodlight in interface LampController
        Parameters:
        color - Use Color enumeration constant to control lamp colors.
        Returns:
        True if lamp changed, false if lamp color doesn't exist for this sensor.
      • getFloodlight

        public int getFloodlight()
        Description copied from interface: LampController
        Returns the color of the floodlight, including Color.NONE.
        Specified by:
        getFloodlight in interface LampController
        Returns:
        An enumeration of the current color.
      • isFloodlightOn

        public boolean isFloodlightOn()
        Description copied from interface: LampController
        Checks if the floodlight is currently on.
        Specified by:
        isFloodlightOn in interface LampController
        Returns:
        true if on, false if off.
      • getRedMode

        public SensorMode getRedMode()
        get a sample provider the returns the light value when illuminated with a Red light source.
        Returns:
        the sample provider
      • getAmbientMode

        public SensorMode getAmbientMode()
        get a sample provider the returns the light value when illuminated without a light source.
        Returns:
        the sample provider