### read() Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Starts an asynchronous read cycle for the sensor. ```APIDOC ## void read() ### Description Coordinates enabling the sensor, selecting filters in sequence, and calling the FreqCount library to obtain a full color reading (R, G, and B). ``` -------------------------------- ### begin() Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Initializes the sensor object. This must be called once during the setup() phase for every instance. ```APIDOC ## void begin() ### Description Initializes the object data. This method must be called once during setup() for every object instance as it cannot be fully initialized in the constructor. ``` -------------------------------- ### Define class inheritance and usage example Source: https://majicdesigns.github.io/MD_TCS230/graph_legend.html A set of C++ class definitions used to demonstrate various inheritance and containment relationships in Doxygen graphs. ```cpp /*! Invisible class because of truncation */ class Invisible { }; /*! Truncated class, inheritance relation is hidden */ class Truncated : public Invisible { }; /* Class not documented with doxygen comments */ class Undocumented { }; /*! Class that is inherited using public inheritance */ class PublicBase : public Truncated { }; /*! A template class */ template class Templ { }; /*! Class that is inherited using protected inheritance */ class ProtectedBase { }; /*! Class that is inherited using private inheritance */ class PrivateBase { }; /*! Class that is used by the Inherited class */ class Used { }; /*! Super class that inherits a number of other classes */ class Inherited : public PublicBase, protected ProtectedBase, private PrivateBase, public Undocumented, public Templ { private: Used *m_usedClass; }; ``` -------------------------------- ### bool available() Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Checks if a sensor reading is complete and ready for processing. ```APIDOC ## bool available() ### Description Determines when a sensor read has completed. Returns true when a value is ready for processing, allowing calls to getRGB() or getRaw(). ### Returns - **bool** - true if data is available, false otherwise. ``` -------------------------------- ### Library Configuration Constants Source: https://majicdesigns.github.io/MD_TCS230/_m_d___t_c_s230_8h.html General constants for array sizing and pin definition. ```cpp const uint8_t RGB_SIZE = 3; const uint8_t NO_PIN = 0xff; ``` -------------------------------- ### MD_TCS230(uint8_t s2, uint8_t s3, uint8_t s0, uint8_t s1) Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Instantiates the class with pins for color filter selection and prescaler control. ```APIDOC ## MD_TCS230(uint8_t s2, uint8_t s3, uint8_t s0, uint8_t s1) ### Description Instantiate a new instance of the class. Optionally, s0 and s1 can be specified to allow changes to the prescaler. ### Parameters - **s2** (uint8_t) - Arduino output pin connected to sensor s2 input. - **s3** (uint8_t) - Arduino output pin connected to sensor s3 input. - **s0** (uint8_t) - Arduino output pin connected to sensor s0 input. - **s1** (uint8_t) - Arduino output pin connected to sensor s1 input. ``` -------------------------------- ### MD_TCS230(uint8_t s2, uint8_t s3, uint8_t s0, uint8_t s1, uint8_t oe) Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Constructor to instantiate a new MD_TCS230 object and configure the hardware pins. ```APIDOC ## MD_TCS230(uint8_t s2, uint8_t s3, uint8_t s0, uint8_t s1, uint8_t oe) ### Description Instantiates a new instance of the MD_TCS230 class. Configures the Arduino pins connected to the sensor's control inputs. ### Parameters - **s2** (uint8_t) - Arduino output pin connected to sensor s2 input. - **s3** (uint8_t) - Arduino output pin connected to sensor s3 input. - **s0** (uint8_t) - Arduino output pin connected to sensor s0 input. - **s1** (uint8_t) - Arduino output pin connected to sensor s1 input. - **oe** (uint8_t) - Arduino output pin connected to sensor oe input. ``` -------------------------------- ### MD_TCS230(uint8_t s2, uint8_t s3) Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Instantiates the class with the minimum required pins for color filter selection. ```APIDOC ## MD_TCS230(uint8_t s2, uint8_t s3) ### Description Instantiate a new instance of the class using the minimum required pins for color filter selection. ### Parameters - **s2** (uint8_t) - Arduino output pin connected to sensor s2 input. - **s3** (uint8_t) - Arduino output pin connected to sensor s3 input. ``` -------------------------------- ### MD_TCS230(uint8_t s2, uint8_t s3, uint8_t oe) Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Instantiates the class with pins for color filter selection and an optional output enable pin for multiple sensors. ```APIDOC ## MD_TCS230(uint8_t s2, uint8_t s3, uint8_t oe) ### Description Instantiate a new instance of the class. Optionally, the oe pin can be specified if multiple sensors are to be connected. ### Parameters - **s2** (uint8_t) - Arduino output pin connected to sensor s2 input. - **s3** (uint8_t) - Arduino output pin connected to sensor s3 input. - **oe** (uint8_t) - Arduino output pin connected to sensor oe input. ``` -------------------------------- ### Sensor Configuration Methods Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Methods to configure sensor hardware settings such as filters, frequency scaling, and calibration. ```APIDOC ## Configuration Methods ### begin() Initializes the sensor hardware. ### setFilter(uint8_t f) Sets the color filter. ### setFrequency(uint8_t f) Sets the frequency scaling. ### setEnable(bool t) Enables or disables the sensor. ### setSampling(uint8_t t) Sets the sampling mode. ### setDarkCal(sensorData *d) Sets the dark calibration data. ### setWhiteCal(sensorData *d) Sets the white calibration data. ``` -------------------------------- ### Library Dependencies Source: https://majicdesigns.github.io/MD_TCS230/_m_d___t_c_s230_8h.html Required header files for the MD_TCS230 library functionality. ```cpp #include #include ``` -------------------------------- ### Include MD_TCS230 Library Source: https://majicdesigns.github.io/MD_TCS230/_m_d___t_c_s230_8cpp.html Include the library header file to access TCS230 sensor functionality. ```cpp #include ``` -------------------------------- ### MD_TCS230 Constructor Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Initializes the MD_TCS230 object with the specified pin assignments for the sensor control lines. ```APIDOC ## MD_TCS230(uint8_t s2, uint8_t s3, [uint8_t s0, uint8_t s1], [uint8_t oe]) ### Description Constructs the sensor object. Various overloads allow specifying pins for S2, S3, S0, S1, and OE control lines. ### Parameters - **s2** (uint8_t) - Required - Pin connected to S2 - **s3** (uint8_t) - Required - Pin connected to S3 - **s0** (uint8_t) - Optional - Pin connected to S0 - **s1** (uint8_t) - Optional - Pin connected to S1 - **oe** (uint8_t) - Optional - Pin connected to OE ``` -------------------------------- ### Data Acquisition Methods Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Methods to read and retrieve color data from the sensor. ```APIDOC ## Data Acquisition Methods ### read() Triggers a sensor reading. ### available() Returns true if new data is available. ### getRGB(colorData *rgb) Retrieves the processed RGB color data. ### getRaw(sensorData *d) Retrieves the raw sensor data. ### readSingle() Performs a single reading and returns the value as uint32_t. ``` -------------------------------- ### setWhiteCal(sensorData *d) Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Sets the white balance calibration data using a pointer to a sensorData structure. ```APIDOC ## void setWhiteCal(sensorData *d) ### Description Sets the values to be used as the white balance calibration data. These numbers can be obtained from getRaw() during the calibration process. ### Parameters - **d** (sensorData *) - Required - Pointer to a sensorData structure containing the calibration data. ``` -------------------------------- ### readSingle() Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Performs a synchronous, blocking read of the sensor. ```APIDOC ## uint32_t readSingle() ### Description Initiates a blocking read of the sensor. Returns the raw data in Hz once the cycle is complete. ### Returns - **uint32_t** - The raw data read from the sensor in Hz. ``` -------------------------------- ### MD_TCS230 Class Methods Source: https://majicdesigns.github.io/MD_TCS230/functions.html A collection of public methods available in the MD_TCS230 class for sensor initialization, configuration, and data acquisition. ```APIDOC ## MD_TCS230 Class Methods ### Available Methods - **MD_TCS230()**: Constructor for the sensor object. - **~MD_TCS230()**: Destructor for the sensor object. - **begin()**: Initializes the sensor hardware. - **available()**: Checks if new sensor data is available. - **read()**: Reads the current color values. - **readSingle()**: Reads a single color component. - **getRaw()**: Retrieves raw sensor data. - **getRGB()**: Retrieves processed RGB color values. - **setDarkCal()**: Sets the dark calibration values. - **setWhiteCal()**: Sets the white calibration values. - **setEnable()**: Enables or disables the sensor. - **setFilter()**: Configures the color filter settings. - **setFrequency()**: Sets the output frequency scaling. - **setSampling()**: Configures the sampling rate. ``` -------------------------------- ### setFrequency() Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Sets the frequency prescaler for the sensor output. ```APIDOC ## void MD_TCS230::setFrequency(uint8_t f) ### Description Set the outputs s0, s1 to match the specified frequency prescaler. This is one of the defined values TCS230_FREQ_*. ### Parameters - **f** (uint8_t) - Required - The required filter, one of TCS230_FREQ_*. ``` -------------------------------- ### Array Size Macro Source: https://majicdesigns.github.io/MD_TCS230/_m_d___t_c_s230_8h.html Macro to calculate the number of elements in an array. ```cpp #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) ``` -------------------------------- ### setEnable() Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Enables or disables the sensor output using the OE pin or frequency scaling pins. ```APIDOC ## void MD_TCS230::setEnable(bool t) ### Description Enable (true) or disable (false) sensor output. The method uses the OE pin if defined, or the S0/S1 pins to set the frequency to TCS230_FREQ_OFF. ### Parameters - **t** (bool) - Required - True to enable the device, false to disable. ``` -------------------------------- ### getRGB() Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Retrieves the last sensor reading in RGB format. ```APIDOC ## void getRGB(colorData *rgb) ### Description Retrieves the last read sensor data in RGB format into the provided structure. ### Parameters - **rgb** (colorData*) - Required - Pointer to a colorData structure to receive the RGB data. ``` -------------------------------- ### getRaw() Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Retrieves the raw sensor data from the last reading. ```APIDOC ## void getRaw(sensorData *d) ### Description Retrieves the last read sensor data as raw counts into the provided structure. ### Parameters - **d** (sensorData*) - Required - Pointer to a sensorData structure to receive the RGB data. ``` -------------------------------- ### MD_TCS230 Library Functions Source: https://majicdesigns.github.io/MD_TCS230/functions_func.html A list of public methods available in the MD_TCS230 class for sensor interaction. ```APIDOC ## MD_TCS230 Class Methods - **available()**: Checks if sensor data is available. - **begin()**: Initializes the sensor. - **getRaw()**: Retrieves raw sensor data. - **getRGB()**: Retrieves color data in RGB format. - **MD_TCS230()**: Constructor for the class. - **read()**: Reads sensor values. - **readSingle()**: Reads a single sensor value. - **setDarkCal()**: Sets dark calibration values. - **setEnable()**: Enables or disables the sensor. - **setFilter()**: Configures the sensor color filter. - **setFrequency()**: Sets the sensor output frequency. - **setSampling()**: Configures the sampling rate. - **setWhiteCal()**: Sets white calibration values. - **~MD_TCS230()**: Destructor for the class. ``` -------------------------------- ### setSampling(uint8_t t) Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Sets the sampling period divisor for the sensor. Higher divisors result in shorter sample times, which are faster but less accurate. ```APIDOC ## void setSampling(uint8_t t) ### Description Sets the sampling period divisor. The library defaults to a maximum of 1000ms for a sample (divisor = 1). Higher divisors create shorter sample times (e.g., 5 = 200ms, 10 = 100ms, 100 = 10ms). Shorter samples are less accurate and only recommended when the range of colors to be detected are highly separated on the RGB color chart. ### Parameters - **t** (uint8_t) - Required - Cycle time divisor. ``` -------------------------------- ### Frequency Scaling Constants Source: https://majicdesigns.github.io/MD_TCS230/_m_d___t_c_s230_8h.html Constants used for setting the TCS230 frequency prescaler. ```cpp const uint8_t TCS230_FREQ_HI = 0; const uint8_t TCS230_FREQ_MID = 1; const uint8_t TCS230_FREQ_LO = 2; const uint8_t TCS230_FREQ_OFF = 3; ``` -------------------------------- ### setFilter() Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Sets the photodiode filter type for the sensor. ```APIDOC ## void MD_TCS230::setFilter(uint8_t f) ### Description Set the outputs s2, s3 to match the specified photodiode filter. This is one of the defined values TCS230_RGB_*. ### Parameters - **f** (uint8_t) - Required - The required filter, one of TCS230_RGB_*. ``` -------------------------------- ### setDarkCal() Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Sets the dark calibration data for the sensor using a provided sensorData structure. ```APIDOC ## void MD_TCS230::setDarkCal(sensorData *d) ### Description Sets the values to be used as the dark calibration data. These numbers can be obtained from getRaw() during the calibration process. ### Parameters - **d** (sensorData*) - Required - Pointer to a sensorData structure containing the calibration data. ``` -------------------------------- ### Color Filter Selection Constants Source: https://majicdesigns.github.io/MD_TCS230/_m_d___t_c_s230_8h.html Constants for selecting the color detector filter on the TCS230 sensor. ```cpp const uint8_t TCS230_RGB_R = 0; const uint8_t TCS230_RGB_G = 1; const uint8_t TCS230_RGB_B = 2; const uint8_t TCS230_RGB_X = 3; ``` -------------------------------- ### Debug Macros Source: https://majicdesigns.github.io/MD_TCS230/_m_d___t_c_s230_8cpp.html Macros used for serial debugging. Set DEBUG_TCS230 to 1 to enable output. ```cpp #define DEBUG_TCS230 0 #define DUMP(s, v) #define DUMPS(s) ``` -------------------------------- ### ~MD_TCS230() Source: https://majicdesigns.github.io/MD_TCS230/class_m_d___t_c_s230.html Destructor for the MD_TCS230 class. ```APIDOC ## ~MD_TCS230() ### Description Class destructor. Releases allocated memory and performs cleanup when the object is no longer required. ``` -------------------------------- ### sensorData Structure Definition Source: https://majicdesigns.github.io/MD_TCS230/structsensor_data.html The sensorData struct contains an array of three int32_t values representing raw R, G, and B readings. ```cpp int32_t | **value** [RGB_SIZE] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.