This is the description of the TCP/IP protocol for the Color Bricklet. General information and technical specifications for the Color Bricklet are summarized in its hardware description.
A general description of the TCP/IP protocol structure can be found here.
BrickletColor.
get_color
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Returns the measured color of the sensor.
The red (r), green (g), blue (b) and clear (c) colors are measured with four different photodiodes that are responsive at different wavelengths:
If you want to get the color periodically, it is recommended
to use the CALLBACK_COLOR
callback and set the period with
set_color_callback_period
.
BrickletColor.
light_on
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Turns the LED on.
BrickletColor.
light_off
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Turns the LED off.
BrickletColor.
is_light_on
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Returns the state of the LED. Possible values are:
The following meanings are defined for the elements of this function:
For light:
BrickletColor.
set_config
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Sets the configuration of the sensor. Gain and integration time can be configured in this way.
For configuring the gain:
For configuring the integration time:
Increasing the gain enables the sensor to detect a color from a higher distance.
The integration time provides a trade-off between conversion time and accuracy. With a longer integration time the values read will be more accurate but it will take longer time to get the conversion results.
The following meanings are defined for the elements of this function:
For gain:
For integration_time:
BrickletColor.
get_config
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Returns the configuration as set by set_config
.
The following meanings are defined for the elements of this function:
For gain:
For integration_time:
BrickletColor.
get_illuminance
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Returns the illuminance affected by the gain and integration time as
set by set_config
. To get the illuminance in Lux apply this formula:
lux = illuminance * 700 / gain / integration_time
To get a correct illuminance measurement make sure that the color
values themselves are not saturated. The color value (R, G or B)
is saturated if it is equal to the maximum value of 65535.
In that case you have to reduce the gain, see set_config
.
BrickletColor.
get_color_temperature
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Returns the color temperature.
To get a correct color temperature measurement make sure that the color
values themselves are not saturated. The color value (R, G or B)
is saturated if it is equal to the maximum value of 65535.
In that case you have to reduce the gain, see set_config
.
BrickletColor.
get_identity
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.
The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an Isolator Bricklet is always at position 'z'.
The device identifier numbers can be found here.
BrickletColor.
set_color_callback_period
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Sets the period with which the CALLBACK_COLOR
callback is triggered
periodically. A value of 0 turns the callback off.
The CALLBACK_COLOR
callback is only triggered if the color has changed since the
last triggering.
BrickletColor.
get_color_callback_period
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Returns the period as set by set_color_callback_period
.
BrickletColor.
set_color_callback_threshold
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Sets the thresholds for the CALLBACK_COLOR_REACHED
callback.
The following options are possible:
Option | Description |
---|---|
'x' | Callback is turned off |
'o' | Callback is triggered when the temperature is outside the min and max values |
'i' | Callback is triggered when the temperature is inside the min and max values |
'<' | Callback is triggered when the temperature is smaller than the min value (max is ignored) |
'>' | Callback is triggered when the temperature is greater than the min value (max is ignored) |
The following meanings are defined for the elements of this function:
For option:
BrickletColor.
get_color_callback_threshold
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Returns the threshold as set by set_color_callback_threshold
.
The following meanings are defined for the elements of this function:
For option:
BrickletColor.
set_debounce_period
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Sets the period with which the threshold callback
is triggered, if the threshold
keeps being reached.
BrickletColor.
get_debounce_period
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Returns the debounce period as set by set_debounce_period
.
BrickletColor.
set_illuminance_callback_period
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Sets the period with which the CALLBACK_ILLUMINANCE
callback is triggered
periodically. A value of 0 turns the callback off.
The CALLBACK_ILLUMINANCE
callback is only triggered if the illuminance has changed
since the last triggering.
BrickletColor.
get_illuminance_callback_period
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Returns the period as set by set_illuminance_callback_period
.
BrickletColor.
set_color_temperature_callback_period
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Sets the period with which the CALLBACK_COLOR_TEMPERATURE
callback is
triggered periodically. A value of 0 turns the callback off.
The CALLBACK_COLOR_TEMPERATURE
callback is only triggered if the color temperature
has changed since the last triggering.
BrickletColor.
get_color_temperature_callback_period
¶Function ID: |
|
---|---|
Request: |
|
Response: |
|
Returns the period as set by set_color_temperature_callback_period
.
BrickletColor.
CALLBACK_COLOR
¶Function ID: |
|
---|---|
Response: |
|
This callback is triggered periodically with the period that is set by
set_color_callback_period
. The response value is the color
of the sensor as RGBC.
The CALLBACK_COLOR
callback is only triggered if the color has changed since the
last triggering.
BrickletColor.
CALLBACK_COLOR_REACHED
¶Function ID: |
|
---|---|
Response: |
|
This callback is triggered when the threshold as set by
set_color_callback_threshold
is reached.
The response value is the color
of the sensor as RGBC.
If the threshold keeps being reached, the callback is triggered periodically
with the period as set by set_debounce_period
.
BrickletColor.
CALLBACK_ILLUMINANCE
¶Function ID: |
|
---|---|
Response: |
|
This callback is triggered periodically with the period that is set by
set_illuminance_callback_period
. The response value is the illuminance.
See get_illuminance
for how to interpret this value.
The CALLBACK_ILLUMINANCE
callback is only triggered if the illuminance has changed
since the last triggering.
BrickletColor.
CALLBACK_COLOR_TEMPERATURE
¶Function ID: |
|
---|---|
Response: |
|
This callback is triggered periodically with the period that is set by
set_color_temperature_callback_period
. The response value is the
color temperature.
The CALLBACK_COLOR_TEMPERATURE
callback is only triggered if the color temperature
has changed since the last triggering.