Documentation
  • Introduction
  • Components
    • User Interface
      • Button
      • Checkbox
      • Date Picker
      • Floating Button
      • Image
      • Label
      • List Picker
      • List View
      • List View Image and Text
      • Notifier
      • Radio Button
      • Rating Bar
      • Slider
      • Surface View
      • Spinner
      • Switch
      • TextBox
      • Time Picker
      • Web Viewer
    • Layout
      • Horizontal Arrangement
      • Horizontal Scroll Arrangement
      • Space
      • Table Arrangement
      • Vertical Arrangement
      • Vertical Scroll Arrangement
    • Media
      • Audio Picker
      • Camcorder
      • Camera
      • Image Picker
      • Metadata
      • OCR
      • Player
      • QR Code
      • Sound
      • Sound Recorder
      • Speech Recognizer
      • Text To Speech
      • Video Player
      • Yandex Translate
    • Drawing and Animation
      • Ball
      • Canvas
      • Image Editor
      • Image Sprite
    • Sensors
      • Accelerometer
      • Barcode Scanner
      • Clock
      • Finger Print
      • Gravity Sensor
      • Gyroscope Sensor
      • Light Sensor
      • Location Sensor
      • Magnetic Field Sensor
      • NearField
      • Orientation Sensor
      • Pedometer
      • Pressure Sensor
      • Proximity Sensor
      • Sound Sensor
      • Temperature Sensor
    • Social
      • Contact Picker
      • Email Picker
      • Google Account Picker
      • Phone Call
      • Phone Number Picker
      • Sharing
      • Texting
      • Twitter
    • Storage
      • File
      • Firebase DB
      • Fusiontables Control
      • SQLite
      • Tiny DB
      • Tiny Web DB
    • Connectivity
      • Activity Starter
      • Bluetooth Admin
      • Bluetooth Client
      • Bluetooth Server
      • Download
      • Network
      • Web
      • WiFi
    • Google
      • Google Account Picker
      • Google Maps
      • Google Shortlink
    • LEGO Mindstorms
      • NXT Drive
      • NXT Color Sensor
      • NXT Light Sensor
      • NXT Sound Sensor
      • NXT Touch Sensor
      • NXT Ultrasonic Sensor
      • NXT Direct Commands
      • EV3 Motors
      • EV3 Color Sensor
      • EV3 Gyro Sensor
      • EV3 Touch Sensor
      • EV3 Ultrasonic Sensor
      • EV3 Sound
      • EV3 UI
      • EV3 Commands
    • Monetization
      • AdMob Interstitial
      • AdMob Banner
      • AdMob Rewarded Video
      • Billing
      • Leadbolt
    • Device
      • Audio
      • Device Tools
      • Wallpaper
      • Package
      • Screenshot
    • Experimental
      • Push Notifications
      • Cloud DB
      • Notification
  • Blocks
    • Control
    • Logic
    • Math
    • Text
    • Lists
    • Colors
    • Variables
    • Procedures
    • Screen
    • Any Component
  • Testing
    • Live Development
      • Via WiFi
      • Via USB
    • Makeroid Companion
  • Extensions
    • List of Extensions
    • Creating Extensions
  • Other
    • Backpack
    • Release Notes
      • Andromeda
      • Beta Versions
    • Resources
      • Concept Cards
    • Terms of Service
Powered by GitBook
On this page
  • Properties
  • BluetoothClient
  • SensorPort
  • DetectColor
  • ColorChangedEventEnabled
  • GenerateColor
  • BottomOfRange
  • TopOfRange
  • BelowRangeEventEnabled
  • WithinRangeEventEnabled
  • AboveRangeEventEnabled
  • Events
  • ColorChanged(number color)
  • BelowRange()
  • WithinRange()
  • AboveRange()
  • Methods
  • GetColor ()
  • GetLightLevel ()
  1. Components
  2. LEGO Mindstorms

NXT Color Sensor

A component that provides a high-level interface to a color sensor on a LEGO MINDSTORMS NXT robot

Properties

BluetoothClient

The BluetoothClient component that should be used for communication. Must be set in the Designer

SensorPort

The sensor port that the sensor is connected to. Must be set in the Designer

DetectColor

Whether the sensor should detect color or light.

True indicates that the sensor should detect color; False indicates that the sensor should detect light. If the DetectColor property is set to True, the BelowRange, WithinRange, and AboveRange events will not occur and the sensor will not generate color.

If the DetectColor property is set to False, the ColorChanged event will not occur.

ColorChangedEventEnabled

Whether the ColorChanged event should fire when the DetectColor property is set to True and the detected color changes.

GenerateColor

The color that should generated by the sensor. Only None, Red, Green, or Blue are valid values. The sensor will not generate color when the DetectColor property is set to True.

BottomOfRange

The bottom of the range used for the BelowRange, WithinRange, and AboveRange events.

TopOfRange

The top of the range used for the BelowRange, WithinRange, and AboveRange events.

BelowRangeEventEnabled

Whether the BelowRange event should fire when the DetectColor property is set to False and the light level goes below the BottomOfRange.

WithinRangeEventEnabled

Whether the WithinRange event should fire when the DetectColor property is set to False and the light level goes between the BottomOfRange and the TopOfRange.

AboveRangeEventEnabled

Whether the AboveRange event should fire when the DetectColor property is set to False and the light level goes above the TopOfRange.

Events

ColorChanged(number color)

Detected color has changed.

The ColorChanged event will not occur if the DetectColor property is set to False or if the ColorChangedEventEnabled property is set to False.

BelowRange()

Light level has gone below the range.

The BelowRange event will not occur if the DetectColor property is set to True or if the BelowRangeEventEnabled property is set to False.

WithinRange()

Light level has gone within the range. The WithinRange event will not occur if the DetectColor property is set to True or if the WithinRangeEventEnabled property is set to False.

AboveRange()

Light level has gone above the range.

The AboveRange event will not occur if the DetectColor property is set to True or if the AboveRangeEventEnabled property is set to False.

Methods

GetColor ()

Returns the current detected color, or the color None if the color can not be read or if the DetectColor property is set to False.

GetLightLevel ()

Returns the current light level as a value between 0 and 1023, or -1 if the light level can not be read or if the DetectColor property is set to True.

PreviousNXT DriveNextNXT Light Sensor

Last updated 7 years ago