C_Color class Reference
Skittle Color Sorter

class C_Color

A basic color class for some color operations.

public Attributes

  • The red channel value.
  • The green channel value.
  • The blue channel value.
  • uint16_t c
  • The clear channel value.

public Functions

  • C_Color (COLOR_UNIT red, COLOR_UNIT green, COLOR_UNIT blue, uint16_t clear=0)
  • Initialize a color by red, green, blue, clear (optional) channel values.
  • int compare (const C_Color &) const
  • Compares the color with another color.
  • colorResult compareWithColorList (const C_Color color_list[], int allowed_variance) const
  • Compares the color with an array of colors. This function is to find the color result that is the closest to the source color.
  • void maximize ()
  • Maximizes color based on the clear value.
  • void print () const
  • Prints the color information onto the Serial.

public static Functions

  • C_Color createFromRawColors (int cycles, uint16_t red, uint16_t green, uint16_t blue, uint16_t clear=0)
  • Create a color from raw colors reported by the color sensor. This will convert the color to the standard unified 8-bits wide RGB channel for convinience of further analyzation.