Home ArduinoArduino Code Arduino and rainbow shield example

Arduino and rainbow shield example

Just a couple of rainbow shield examples that will randomly light up the various LEDs with different colours

 

[codesyntax lang=”cpp”]

#include <Rainbowduino.h>

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

unsigned char x,y,z;

void loop()
{



     Rb.fillRectangle(0, 0, 8, 8, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels
     delay(1000);
     Rb.blankDisplay();
  
}

[/codesyntax]

 

[codesyntax lang=”cpp”]

#include <Rainbowduino.h>


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

unsigned char x,y,z;

void loop()
{
    for(x=0;x<8;x++)
    {
     for(y=0;y<8;y++)
      {
      Rb.setPixelXY(x,y,random(0xFF),random(0xFF),random(0xFF)); //uses R, G and B bytes
      }
    }

    delay(1000);

}

[/codesyntax]

You may also like