Data Sheet

Core Spartan Documentation Modern Robotics, Inc
Version 3.0.3 Page 59
int getColorIndex(void)
This function returns a 6-bit color index in one byte. Bits 5 and 4 encode the red
color index, bits 3 and 2 encode the green color index and bits 1 and 0 encode
the blue color index.
int value;
value = colour.getColorIndex();
…or…
Serial.print(colour.getColorIndex());
void getRGBIndex(int *red, int *green, int *blue)
This function gets the analog values of the three primary color channels with an
intensity correction whereby 0xFF is the strongest signal. There is no return for
this function; instead there are pointers for parameters. Therefore, the
parameters will be updated by the function at the exact same time.
colour.getRGBIndex(red, green, blue);
void getRGB(char color)
This function gets the analog values of the three primary color channels with an
intensity correction whereby 0xFF is the strongest signal. This function returns a
single reading in the form of an integer. Therefore, the parameters are updated
individually at different times.
red_value = colour.getRGB(color.RED);
green_value = colour.getRGB(color.GREEN);
blue_value = colour.getRGB(color.BLUE);
void getColorReading(int *red, int *green, int *blue, int *white)
This function gets the analog value of the color channels in a 16-bit format.
Therefore there is much more detail in the reading as compared to the index
reading. There is no return for this function; instead there are pointers for
parameters. Therefore the parameters will be updated by the function.
colour.getRGBReading(red, green, blue, white);