[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

@Todd_Meyer @vseven

Todd and Allan,

I just wanted to give you a heads up that I made some significant changes to the TCS34725 device yesterday. The new code is in my Github repo. It should still be 100% backwards compatible, except for one notable exception…

In my testing with this sensor, I had to specify an Integration time and Gain in order to get reasonable data out of the sensor. The default time of 2.4ms and 1x gain were too low. I have made these optional parameters that are passed into the constructor of the object. I have defaulted them as documented in the comments section at the top if the .h and .cpp files.

Also, I believe the Adafruit TCS34725 library introduces unnecessary delays based on the integration time selected. Since we do not poll this sensor continuously, it makes no sense to add up to 700ms of delay time when accessing the value stored in the device’s memory. The device is always updating its data, and we are just reading it most current values. Therefore, I modified the Adafruit TCS34725 library to comment out these delay() statements. The version of the TCS34725 library in my github repository has these changes.

Here is the documentation…

//******************************************************************************************
//  File: PS_AdafruitTCS34725_Illum_Color.h
//  Authors: Dan G Ogorchock & Daniel J Ogorchock (Father and Son)
//
//  Summary:  PS_AdafruitTCS34725_Illum_Color is a class which implements the SmartThings "Illuminance Measurement" device capability.
//			  It inherits from the st::PollingSensor class.  It uses I2C communication to measure the RGB Illuminace from a TCS34725 sensor.
//			  
//			  Create an instance of this class in your sketch's global variable section
//			  For Example:  st::PS_AdafruitTCS34725_Illum_Color sensor1(F("illuminancergb1"), 60, 0);
//
//			  st::PS_AdafruitTCS34725_Illum_Color() constructor requires the following arguments
//				- String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
//				- long interval - REQUIRED - the polling interval in seconds
//				- long offset - REQUIRED - the polling interval offset in seconds - used to prevent all polling sensors from executing at the same time
//				- tcs34725IntegrationTime_t integrationTime - OPTIONAL - defaults to TCS34725_INTEGRATIONTIME_154MS
//				- tcs34725Gain_t gain - OPTIONAL - defaults to TCS34725_GAIN_4X
//
//              Valid Integration Time Values:
//				  TCS34725_INTEGRATIONTIME_2_4MS = 0xFF,   /**<  2.4ms - 1 cycle    - Max Count: 1024  */
//				  TCS34725_INTEGRATIONTIME_24MS = 0xF6,    /**<  24ms  - 10 cycles  - Max Count: 10240 */
//				  TCS34725_INTEGRATIONTIME_50MS = 0xEB,    /**<  50ms  - 20 cycles  - Max Count: 20480 */
//				  TCS34725_INTEGRATIONTIME_101MS = 0xD5,   /**<  101ms - 42 cycles  - Max Count: 43008 */
//				  TCS34725_INTEGRATIONTIME_154MS = 0xC0,   /**<  154ms - 64 cycles  - Max Count: 65535 */
//				  TCS34725_INTEGRATIONTIME_700MS = 0x00    /**<  700ms - 256 cycles - Max Count: 65535 */
//
//				Valid Gain Values:
//				  TCS34725_GAIN_1X = 0x00,    /**<  No gain  */
//				  TCS34725_GAIN_4X = 0x01,    /**<  4x gain  */
//				  TCS34725_GAIN_16X = 0x02,   /**<  16x gain */
//				  TCS34725_GAIN_60X = 0x03    /**<  60x gain */