The ColorPal and WS2812 RGB LED blocks were both designed to combine all red, green and blue color values into a single 24-bit number. While the individual red, green and blue components may also be captured individually, it’s really easy to use these two blocks together with one variable named color.
Simply sense the color with the ColorPal, save it in a variable, and output it on the WS2812 RGB LEDs.
Color sorting has many applications beyond putting Skittles in the right cup like our Color Candy Sorter Project. Identifying fruit colors, color paint chip matching, robot navigation, and industrial automation are typical uses for sensors like the ColorPal.
- (3 or more) - WS2812 RGB LED (#28085)
- (1) - ColorPal (#28380)
- (assorted) color sample swatches
- FLiP Module or Propeller Activity Board (original or WX)
- Propeller P0 to #1 WS2812 RGB LED SI (Serial In)
- First RGB LED’s SO (serial out) to second RGB LED’s SI
- Second RGB LED SO to third RGB LED SI
- RGB LED 5V connections to 5VDC
- RGB LED GND connections to Propeller FLiP module GND pin
- ColorPal signal pin to Propeller P1
- ColorPal +5V to 5VDC
- ColorPal GND to GND
Load the ColorPal Sensor and Color Display code below and try it out. This Blockly code is simple enough to explain itself, yet the omission of any block of code would cause it not to work. Test it with fruit, paper, a smartphone, and book covers by placing your color samples in front of the ColorPal sensor.