Available for Activity Board, FLiP, and Other board types. Not available for Badge or Scribbler Robot board types. I/O pin range options will vary with board type.
These blocks use a ColorPal Color Sensor (#28380) [1]
New to this sensor? Click here to see an example schematic and quick Blockly program [2] to help you get started.
This block launches a processor automatically, one per block instance.
The ColorPal initialize block sets up the ColorPal sensor. If you forget to use this block, other LCD blocks will remind you with a triangle-shaped warning icon:
From the PIN dropdown, select the Propeller I/O pin number that is connected to the ColorPal module's signal pin.
If you use more than one ColorPal initialize block in a project, the other ColorPal blocks will provide a drop-down to select the Propeller I/O pin for your target ColorPal module.
The ColorPal raw colors block measures the amount of red, green, and blue it detects. Each of those three raw values is stored in the corresponding variable selected in each drop-down menu. The raw values can range from 0 to 4095. The raw values are not white-balanced, but when used correctly, they can be more accurate than the value provided by the ColorPal get color block.
The ColorPal get color block takes a measurement and provides a single, approximate white-balanced, 24-bit color value that is stored in the variable selected in the drop-down. That variable can then be used with other color value blocks [3].
For sensing color, the ColorPAL uses its LED to illuminate a sample, one color component at a time, along with a broad-spectrum light-to-voltage converter to measure the light reflected back. The amount of light reflected from the sample under illumination from each red, green, and blue LED can be used to determine the sample’s color.
If using a Propeller Activity Board, the ColorPal can be connected to either the breadboard or via a 3-wire extension cable to one of the servo headers P12-P17.
Using the connections shown in the wiring diagram above, this example will display the RGB values detected by the ColorPal in the Terminal. Try holding differently-colored objects up to the sensor to see their RGB values.
Links
[1] http://www.parallax.com/product/28380
[2] https://learn.parallax.com/support/reference/activity-board-wx-block-reference/sensor/colorpal/colorpal-wiring-code-example
[3] http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/values