Hi, I could not understand why we use 20% frequency scailing for TCS3200 color sensor and what the diffirence between 2%, 20%, 100% frequency.
Manufacturer's page of the AMS / TAOS TCS3200: https://ams.com/tcs3200.
Its maximum output frequency is 600kHz. That is a high frequency. For slower microcontrollers it can be lowered. For example with a internal divider in the sensor of 50 the maximum output frequency is 12kHz.
Long time ago, some sensors would output a frequency. That was the only way to get accurate data to a microcontroller. However, since 1982 there is the I2C bus to communicate with sensors. You should not use this sensor. It is a whole lot of trouble for nothing.
Product Status: Discontinued
Try something like:
Or if you need more resolution and sensitivity:
Adafruit probably still sells modules based on TCS34725, but this sensor has also been discontinued by AMS. I bet Adafruit c.s. will migrate to TCS3410 or a similar product as well.
At 600 kHz the minimum pulse duration is 0.833 microseconds, too small to be measured with pulseIn() which measures in full microseconds.
At 20% scale the minimum pulse duration is 4.166 microseconds, a reasonable minimum for pulseIn(). This also has the effect of averaging 5 readings to reduce noise.
The 2% scale averages 50 readings so it is even more immune to noise.