1
SKILL
LEVEL
Ringo Educational Guide Rev04.1 ~ Plum Geek
Using Ringo’s Color Lights
void loop(){
SetPixelRGB( 3, 220, 30, 160); //set pixel 3 to 220 R, 30 G, and 160 B
}
void loop(){
SetPixelRGB( 4, 220, 30, 160); //set pixel 4 (Right eye)
SetPixelRGB( 5, 220, 30, 160); //set pixel 5 (Left eye)
}
void loop(){
SetPixelRGB( 4, 220, 30, 160); //set pixel 4 (Right eye)
SetPixelRGB( 5, 220, 30, 160); //set pixel 5 (Left eye)
delay(100);
SetPixelRGB( 4, 30, 220, 210); //set pixel 4 (Right eye)
SetPixelRGB( 5, 30, 220, 210); //set pixel 5 (Left eye)
delay(100);
}
Using the basic example above, we can start to play with the numbers in the
function to change the behavior of the pixels. Let’s say your favorite color is
something different than red, or green, or blue. Like, PLUM! You can easily create
different colors by mixing different amounts of the three primary colors Red, Green,
and Blue. Try this example code. Compile it, load it, and observe what happens.
Sweet! Purple, right? I think you’re getting the idea now. So what if you want to
control more than one pixel at a time? What if we want to make both of Ringo’s
eyes turn purple? We just do the same thing, except we call the
SetPixelRGB
function more than once. We call it once for the right eye, and again for the left eye,
then finally after both eyes have been commanded to a new value, we will latch the
new colors by executing the
RefreshPixels();
function. Like this:
Purple eyes? Easy right? I think you’ve got the hang of it now. Now lets have some
real fun. One more example then you can go off and play on your own.
Example Sketch: Ringo_Guide_Pixels_01