icommand.nxt
Class ColorSensor

java.lang.Object
  extended by icommand.nxt.I2CSensor
      extended by icommand.nxt.ColorSensor

public class ColorSensor
extends I2CSensor

HiTechnic color sensor.
www.hitechnic.com

Author:
BB

Field Summary
 
Fields inherited from class icommand.nxt.I2CSensor
DEFAULT_ADDRESS, PRODUCT_ID, SENSOR_TYPE, STOP, VERSION
 
Constructor Summary
ColorSensor(SensorPort s)
          Creates an instance of the ColorSensor
 
Method Summary
 int getBlue()
          Returns the blue saturation of the color.
 int getColorNumber()
          Returns the color index detected by the sensor.
 int getGreen()
          Returns the green saturation of the color.
 int getRed()
          Returns the red saturation of the color.
 
Methods inherited from class icommand.nxt.I2CSensor
fetchString, getData, getData, getId, getProductID, getSensorType, getVersion, sendData, sendData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorSensor

public ColorSensor(SensorPort s)
Creates an instance of the ColorSensor

Parameters:
s -
Method Detail

getColorNumber

public int getColorNumber()
Returns the color index detected by the sensor.

Returns:
Color index.
  • 0 = black
  • 1 = violet
  • 2 = purple
  • 3 = blue
  • 4 = green
  • 5 = lime
  • 6 = yellow
  • 7 = orange
  • 8 = red
  • 9 = crimson
  • 10 = magenta
  • 11 to 16 = pastels
  • 17 = white

  • getRed

    public int getRed()
    Returns the red saturation of the color.

    Returns:
    red value (0 to 255).

    getGreen

    public int getGreen()
    Returns the green saturation of the color.

    Returns:
    green value (0 to 255).

    getBlue

    public int getBlue()
    Returns the blue saturation of the color.

    Returns:
    blue value (0 to 255).


    Copyright 2006. All Rights Reserved.