Home ArduinoArduino Code Rainbowduino example for Arduino

Rainbowduino example for Arduino

I had one of the Rainbowduino/ColorDuino type shields in my box of parts, so I decided to throw up a quick example. The Rainbowduino can be use to drive 8×8 RGB Led Matrices or a 4x4x4 RGB LED Cube in common Anode mode.They are interesting for playing around with, practical uses probably not many. You could throw up a game maybe or some lighting effects, maybe a mood light. Anyway they are good fun for playing about with and I do like messing with LEDs.

Its a nice board for practicing some programming skills, in particular loops. The example below shows a decrementing for loop as an example

Here is a picture of the shield fitted to an Arduino board and also there is an 8×8 matrix fitted to the shield, you usually buy these seperately

 

rainbowduino

rainbowduino

Code

In this example we create a filled rectangle of a random color which will slowly shrink in size and

Library I used was at http://www.seeedstudio.com/wiki/images/4/43/Rainbowduino_for_Arduino1.0.zip

[codesyntax lang=”cpp”]

#include <Rainbowduino.h>

void setup()
{
 Rb.init();
}

unsigned char y;

void loop()
{
 for(y=8;y>=1;--y)
 {
 Rb.fillRectangle(0, 0, y, y, random(0xFFFFFF)); // draw a filled rectangle line from (0,0), the width reduces per loop, also a random color every time
 delay(1000);
 Rb.blankDisplay();
 } 
}

[/codesyntax]

 

Links

 

2Pcs 8×8 Matrix RGB LED Common Anode Diffused Full Colour For Rainbowduino H1E1

Rainbowduino LED driver platform – Atmega 328

You may also like