ColorSensor class Reference
Skittle Color Sorter

class ColorSensor

extends Adafruit_TCS34725, Context

A subclass of Adafruit_TCS34725 Color Sensor. This class contains all the algorithms regarding to color detection, analyzation.

protected Attributes

  • unsigned long lastSkittleTime
  • Time when the last skittle arrived.
  • boolean isMeasuring
  • Is the a Skittle being measured right now.

public Functions

  • ColorSensor ()
  • Constructor.
  • void setup ()
  • Initializes I2C and configures the sensor. This function should be called before you do anything else.
  • void update ()
  • The main logic of the color sensor. This function should be called on the main loop.
  • unsigned long getLastSkittleTime ()
  • Get the time when the last time the color sensor was measuring a Skittle.

protected Functions

  • void _calibrating (const C_Color &)
  • The update logic used to test and get the average color of certain Skittle.
  • colorResult _analyzeColor (const C_Color &)
  • Performs certain actions after the best color has been picked up by the color sensor. This function will be called each time the color sensor is through a measuring cycle.

Top