TCS34725 interrupt value range?

I am using the Adafruit_TCS34725 library with a TCS34725 breakout board

I have the code and interrupt working but I am confused about setting the interrupt limits.

Desired functionality would be for the interrupt to occur when a C value within a specified range is detected and not outside of it.

However, the specification states:

Two 16-bit interrupt threshold registers allow the user to set limits below and above a desired light level. An
interrupt can be generated when the Clear data (CDATA) is less than the Clear interrupt low threshold (AILTx)
or is greater than the Clear interrupt high threshold (AIHTx).
It is important to note that the thresholds are evaluated in sequence, first the low threshold, then the high
threshold. As a result, if the low threshold is set above the high threshold, the high threshold is ignored and only
the low threshold is evaluated.
To further control when an interrupt occurs, the device provides a persistence filter. The persistence filter allows
the user to specify the number of consecutive out-of-range Clear occurrences before an interrupt is generated.
The persistence filter register (0x0C) allows the user to set the Clear persistence filter (APERS) value. See the
persistence filter register for details on the persistence filter value. Once the persistence filter generates an
interrupt, it will continue until a special function interrupt clear command is received (see command register).

The range is confusing me. I can't seem to figure out how to set the limit to trigger when it is within a given range. Instead this looks like it can only be setup to trigger when it is **outside ** of a given range. Very confusing.

Low_limit > Interrupt_Value > High_value

Here is some example output:

Color Temp: 4082 K - Lux: 68 - R: 85 G: 88 B: 59 C: 229
[D][main.cpp:271] magTag_ISR(): magTag_ISR called.
Color Temp: 4057 K - Lux: 69 - R: 87 G: 90 B: 60 C: 232
[D][main.cpp:271] magTag_ISR(): magTag_ISR called.
Color Temp: 4005 K - Lux: 80 - R: 100 G: 103 B: 68 C: 267  
[D][main.cpp:271] magTag_ISR(): magTag_ISR called.
Color Temp: 3939 K - Lux: 77 - R: 99 G: 100 B: 66 C: 260  
[D][main.cpp:271] magTag_ISR(): magTag_ISR called.
Color Temp: 3733 K - Lux: 68 - R: 94 G: 90 B: 59 C: 240  
[D][main.cpp:271] magTag_ISR(): magTag_ISR called.
Color Temp: 3770 K - Lux: 68 - R: 93 G: 90 B: 59 C: 238

I want to trigger the interrupt when: 300 < C < 1000.

The following does not work as it would only trigger if the value is less than 300 or greater than 1000. Ok, what am I missing here because it seems like this limit is useless for anyone wanting trigger on detecting a color range?

tcs.setIntLimits(300,1000);

Why do you need to use interrupts? Why not just poll the device and have your code determine in-range / out-of-range?

Also, post your code using Code Tags.

Welcome

The interrupt feature simplifies and improves system efficiency by eliminating the need to poll the sensor for
light intensity values outside of a user-defined range

In other words, if you want to check if the value is inside a range, there is no other choice than continuously polling the sensor