ColorPAL documentation
© Parallax, Inc. • ColorPAL (2009.06.15) Page 9 of 12
tnn
Set Inter-color Transition Time
By default, when colors are displayed in sequence, it’s done one color after the other without any kind of
transition. This behavior can be modified by setting a non-zero transition time between colors. The two-
hex-digit argument accompanying this command establishes the
rate
at which one color blends into the
next during a transition. The overall transition time depend on how dissimilar the two colors are to begin
with. Colors whose RGB components differ by a lot will take more time in their transition than those
whose components are closer. Here’s an example of red blending into blue:
SEROUT sio, baud, ["= R tC0 B !"]
— Light Sensing Commands —
s
Sample Output from Light Sensor Returns:
nnn
The ColorPAL incorporates a 10-bit analog-to-digital converter to read the voltage output from the
TSL13T light sensor. When the sample command is executed, it takes a reading then outputs it as three
hexadecimal digits. Here is how you might take a green color reading, subtracting the ambient light, for
example:
Red VAR Word
Grn VAR Word
Blu VAR Word
Amb VAR Word
...
SEROUT sio, baud, ["= X s !"]
SERIN sio, baud, [HEX3 Amb]
SEROUT sio, baud, ["= G s !"]
SERIN sio, baud, [HEX3 Grn]
Grn = Grn – Amb
IMPORTANT: When sampling colors with the LED on, use only pure, fully-saturated colors such as R, G,
and B. The reason is that color blends use pulse-width modulation to attain the different shades, and the
sensor is fast enough not to average what it sees over the PWM period. With pure colors, the LED is on
constantly, so this is not an issue.
m
Multi-sample RGB colors Returns:
nnnnnnnnn
This macro function performs an ambient light measurement, then individual measurements with each of
the red, green, and blue LEDs, subtracting the ambient reading from each. It then outputs three 3-digit
hex numbers representing the ambient-corrected red, green, and blue readings. Here’s an example:
Red VAR Word
Grn VAR Word
Blu VAR Word
...
SEROUT sio, baud, ["= m !"]
SERIN sio, baud, [HEX3 Red, HEX3 Grn, HEX3 Blu]
h
Select High Sensitivity
l
Select Low Sensitivity