This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:iot-open:practical:hardware:sut:esp32:emb9b_1 [2024/03/22 07:41] – [Project information] pczekalski | en:iot-open:practical:hardware:sut:esp32:emb9b_1 [2025/04/28 20:34] (current) – [FAQ] pczekalski | ||
---|---|---|---|
Line 50: | Line 50: | ||
=== Step 2 === | === Step 2 === | ||
- | Declare and instantiate TCS controller class and related variables for readings: | + | Declare and instantiate |
<code c> | <code c> | ||
+ | #define SCL 4 | ||
+ | #define SDA 5 | ||
+ | |||
static Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_300MS, | static Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_300MS, | ||
uint16_t r, g, b, c, colorTemp, lux; | uint16_t r, g, b, c, colorTemp, lux; | ||
Line 57: | Line 60: | ||
</ | </ | ||
A word of explanation regarding the parameters: | A word of explanation regarding the parameters: | ||
- | * '' | + | * '' |
* '' | * '' | ||
Line 65: | Line 68: | ||
Initialise the sensor (in '' | Initialise the sensor (in '' | ||
<code c> | <code c> | ||
+ | Wire.begin(SDA, | ||
+ | delay(100); | ||
+ | ... | ||
+ | |||
isTCSOk = tcs.begin(); | isTCSOk = tcs.begin(); | ||
</ | </ | ||
- | You communicate with TCS sensor via I2C interface. In standard and typical configurations there is no need to instantiate '' | + | You communicate with the TCS sensor via the I2C interface. In standard and typical configurations, there is no need to instantiate |
+ | |||
+ | <note important> | ||
=== Step 4 === | === Step 4 === | ||
- | Besides reading raw values for channels R, G, B and C, the '' | + | Besides reading raw values for channels R, G, B and C, the '' |
To read, use the following code: | To read, use the following code: | ||
Line 87: | Line 96: | ||
===== FAQ ===== | ===== FAQ ===== | ||
- | **What is the range of the values for the integration time of the TCS sensor?**: | + | **What is the range of the values for the //integration time// of the TCS sensor?**: |
<code c> | <code c> | ||
#define TCS34725_INTEGRATIONTIME_2_4MS | #define TCS34725_INTEGRATIONTIME_2_4MS | ||
Line 129: | Line 138: | ||
</ | </ | ||
- | **What is the range of the values for the gain of the TCS sensor?**: | + | **What is the range of the values for the //gain// of the TCS sensor?**: |
<code c> | <code c> | ||
typedef enum { | typedef enum { | ||
Line 139: | Line 148: | ||
</ | </ | ||
- | **C channel reading is 0 and R, G or B readings are not reasonable**: It is possibly because | + | **C channel reading is 0, and R, G or B readings are unreasonable.** It is possibly because of overdriving |
<WRAP noprint> | <WRAP noprint> |