Class HSVDigoutConfig
Basic usage example:
Canandcolor color = new Canandcolor(0); // Check if the an object is close and the color sensor is seeing blue for at least 10 milliseconds, color.digout1().configureSlots(new HSVDigoutConfig() .setMaxProximity(0.15) .setProximityInRangeFor(0.01) .setMinHue(0.5) .setMaxHue(0.7) .setColorInRangeFor(0.01) ); // Instantly send CAN digout frames when the above condition changes at all. color.digout1().configureFrameTrigger(DigoutFrameTrigger.kRisingAndFalling); // Configure the DIG-1 GPIO pin to also output the condition color.digout1().configureOutputPin(DigoutPinConfig.kDigoutLogicActiveHigh); // Check value over CAN color.digout1().getValue();
If the minHue is larger than the maxHue, then
  (minHue <= hue <= 1.0) || (0.0 <= hue <= maxHue)
 is instead evaluated, which can be used to screen for red hues. E.g. 
 
Canandcolor color = new Canandcolor(0); // Check for red values: color.digout1().configureSlots(new HSVDigoutConfig() .setMinHue(0.8) .setMaxHue(0.2) .setColorInRangeFor(0.01) );
will check for hue values from [0.8..1.0] and [0.0..0.2], allowing for proper handling of the wraparound.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionsetColorInRangeFor(double seconds) Sets the minimum time that the color readings have to match the upper and lower HSV thresholds in order for the digout to be true.setMaxHue(double thresh) Sets the value that the HSV hue reading has to be greater than or equal to for the digout to be true.setMaxProximity(double thresh) Sets the value that the proximity reading has to be less than or equal to for the digout to be true.setMaxSaturation(double thresh) Sets the value that the HSV saturation reading has to be greater than or equal to for the digout to be true.setMaxValue(double thresh) Sets the value that the HSV value reading has to be greater than or equal to for the digout to be true.setMinHue(double thresh) Sets the value that the HSV hue reading has to be greater than or equal to for the digout to be true.setMinProximity(double thresh) Sets the value that the proximity reading has to be greater than or equal to for the digout to be true.setMinSaturation(double thresh) Sets the value that the HSV saturation reading has to be greater than or equal to for the digout to be true.setMinValue(double thresh) Sets the value that the HSV value reading has to be greater than or equal to for the digout to be true.setProximityInRangeFor(double seconds) Sets the minimum time that the proximity reading has to match the upper and lower thresholds in order for the digout to be true.
- 
Constructor Details- 
HSVDigoutConfigpublic HSVDigoutConfig()Default constructor.
 
- 
- 
Method Details- 
setMinProximitySets the value that the proximity reading has to be greater than or equal to for the digout to be true.If not specified, this value is 0.0 - Parameters:
- thresh- proximity threshold
- Returns:
- calling object
 
- 
setMaxProximitySets the value that the proximity reading has to be less than or equal to for the digout to be true.If not specified, this value is 1.0 - Parameters:
- thresh- proximity threshold
- Returns:
- calling object
 
- 
setProximityInRangeForSets the minimum time that the proximity reading has to match the upper and lower thresholds in order for the digout to be true.This threshold has millisecond resolution, but the units are still seconds. This threshold has millisecond resolution, but the units are still seconds. - Parameters:
- seconds- The minimum number of seconds. The default value is 0 (zero time required)
- Returns:
- calling object
 
- 
setMinHueSets the value that the HSV hue reading has to be greater than or equal to for the digout to be true.If not specified, this value is 0.0 If the min hue threshold is larger than the max hue threshold, the sensor will evaluate minHue <= hue OR hue <= maxHue instead of the usualminHue <= hue AND hue <= maxHue which is useful when trying to detect red objects as one could set the min hue to 0.9 and the max hue to 0.1 but still get correct results across the wraparound. - Parameters:
- thresh- color value threshold
- Returns:
- calling object
 
- 
setMaxHueSets the value that the HSV hue reading has to be greater than or equal to for the digout to be true.If not specified, this value is 1.0 If the min hue threshold is larger than the max hue threshold, the sensor will evaluate minHue <= hue OR hue <= maxHue instead of the usualminHue <= hue AND hue <= maxHue which is useful when trying to detect red objects as one could set the min hue to 0.9 and the max hue to 0.1 but still get correct results across the wraparound. - Parameters:
- thresh- color value threshold
- Returns:
- calling object
 
- 
setMinSaturationSets the value that the HSV saturation reading has to be greater than or equal to for the digout to be true.If not specified, this value is 0.0 - Parameters:
- thresh- color value threshold
- Returns:
- calling object
 
- 
setMaxSaturationSets the value that the HSV saturation reading has to be greater than or equal to for the digout to be true.If not specified, this value is 1.0 - Parameters:
- thresh- color value threshold
- Returns:
- calling object
 
- 
setMinValueSets the value that the HSV value reading has to be greater than or equal to for the digout to be true.If not specified, this value is 0.0 - Parameters:
- thresh- color value threshold
- Returns:
- calling object
 
- 
setMaxValueSets the value that the HSV value reading has to be greater than or equal to for the digout to be true.If not specified, this value is 1.0 - Parameters:
- thresh- color value threshold
- Returns:
- calling object
 
- 
setColorInRangeForSets the minimum time that the color readings have to match the upper and lower HSV thresholds in order for the digout to be true.This can be used to "debounce" readings by requiring the color to match the thresholds for multiple readings. This threshold has millisecond resolution, but the units are still seconds. - Parameters:
- seconds- The minimum number of seconds. The default value is 0 (zero time required)
- Returns:
- calling object
 
 
-