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.
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.
Project4378-WS2812-ColorPal-And-Display.svg [1]
Links
[1] https://learn.parallax.com/sites/default/files/content/AB-Blockly/Light-It-Up/Project4378-WS2812-ColorPal-And-Display.svg