Red, Green & Blue:
Can you make your Sparkle baton display a rainbow? The simplest way is to set each Sparkle colour, in turn, with the computer’s colour picker:
But do you know how a Sparkle LED can display all these colours? The primary colours of light are red, green and blue (RGB). Each Sparkle has a red, green and blue LED inside and the relative brightness of each of these determines the colours that your eyes see. Mixing equal amounts of red and green gives yellow; green and blue make cyan; and blue and red make magenta. Red, blue and green mix together to make white light.
Under the “Sparkles” menu in the Crumble software is a block which allows you to set the level of each RGB emitter (0 is off; 255 is maximum brightness). The following program will, therefore, display the primary and secondary (yellow, cyan and magenta) colours along the baton.
If you are interested in seeing how other colours are made, the colour picker will tell you the RGB values of the current colour and allow you to change them, via sliders or by typing the value. Here, for example, we have chosen orange:
The red emitter is fully on (255), green is at half-brightness (127) and blue is off. If we now increase the blue to fully on, we get pink:
Note: this is the MacOS colour picker, Windows may look different but should still have the same information. You might also notice a Hexadecimal colour code (Hex code #FF7F00): I won’t go into more detail, here, but if you are interested in computer programming and/or graphic design you should investigate this further.
Colour & the Human Eye:
We can use the block
to show that equal amounts of red, green and blue light mix together to make white light. The program, below, though, also demonstrates our eyes’ persistence of vision.
The last Sparkle on the baton (“sparkle 7”) cycles round the primary colours more and more quickly. The time interval starts at y=1000ms then halves after every z cycles while the number of cycles starts at z=1 and then doubles. As the LEDs cycle faster our eyes will first perceive a flickering and then a steady white light. You can show, though, that the LEDs are still cycling, even when the white light appears steady, by rapidly moving the baton from side to side: now our persistence of vision lets us see separate red, green, and blue “lines”.
Further Colour-mixing Activities:
Can you use your colour mixing knowledge recreate the “rainbow” display, above, but now get it to scroll along the sparkle baton? This diagram may help:
If you have a sparkle matrix, you can experiment with more colour effects. For example, what do you think the following program does?
Or pick your favourite colour(s) to draw a picture:
The next blog post will explore using variables as RGB values and show how to use an input to control the Sparkle colours.