Rainbowduino Rectangle String error

Hey guys. I just got my rainbowduino in and have started coding for it. I can make some basic programs and outputs and I am trying to make my programs are a little more complicated. I am trying to make a program where squares radiate from the center of the led matrix, and they cycle through the colors at different intervals, so it appears as if it is radiating from the center. The problem I am having is that I am converting the RGB number to HEX and storing it in a string, however the Rb.fillCircle command does not like the fact that there is a string where the color code should be.

Here's the code that I am using:

void loop()
{
  while (r<intensity)
  {
    RGB=((r*65536)+(g*256)+b);
    String colorString=String(RGB, HEX);
    Rb.fillRectangle(3,3,2,2,colorString);
    r++;
    b--;
    delay(Delay);
  }
}

And this is the error I am getting:

sketch_nov03b.ino: In function 'void loop()':
sketch_nov03b:16: error: no matching function for call to 'Rainbowduino::fillRectangle(int, int, int, int, String&)'
C:\Users\Ryan\Documents\Arduino\libraries\Rainbowduino/Rainbowduino.h:80: note: candidates are: void Rainbowduino::fillRectangle(unsigned int, unsigned int, unsigned int, unsigned int, uint32_t)

Surgikill:
Here's the code that I am using:

void loop()

{
  while (r<intensity)
  {
    RGB=((r65536)+(g256)+b);
    String colorString=String(RGB, HEX);
    Rb.fillRectangle(3,3,2,2,colorString);
    r++;
    b--;
    delay(Delay);
  }
}

First, you should be posting your entire code, so we know what RGB, r, b, and g are (int? Unsigned long? what?)

Secondly, why would you convert RGB to a String? fillRectangle(), as your error points out, takes three unsigned int, and a uint32_t.

Here's the entire code:

#include <Rainbowduino.h>


void setup()
{
  Rb.init(); //initialize Rainbowduino driver
}
int Delay=10,intensity=255;
int r=0,g=0,b=intensity,x=0,y=0,RGB=0;
void loop()
{
  while (r<intensity)
  {
    RGB=((r*65536)+(g*256)+b);
    String colorString=String(RGB, HEX);
    Rb.fillRectangle(3,3,2,2,colorString);
    r++;
    b--;
    delay(Delay);
  }
  /*while (g<intensity)
  {
    for (x=3;x<5;x++)
    {
      for (y=3;y<5;y++)
      {
        Rb.setPixelXY(x,y,r,g,b);
      }
    }
    g++;
    r--;
    delay(Delay);
  }
 while (b<intensity)
  {
    for (x=3;x<5;x++)
    {
      for (y=3;y<5;y++)
      {
        Rb.setPixelXY(x,y,r,g,b);
      }
    }
    b++;
    g--;
    delay(Delay);
  }*/
}

The first four integers on Rb.fillRectangle() are (inital start point x, initial start point y, length, width, uint32_t);

OK, but you really can't pass a String as a parameter that is looking for a uint32_t.

Try sending it RGB, and not a String representation of its contents. If RGB is declared in your library as a compatible type, it should work.

It won't accept RGB. Here's a wiki link of the commands. It is under RGB Matrix. Rainbowduino v3.0 | Seeed Studio Wiki

Example code is:

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

It won't accept RGB.

Proof?

    RGB=((r*65536)+(g*256)+b);

When r is non-zero, how do you propose to store (65536 * r)+ into a variable that can hold values in the range -32768 to 32767? There is a reason that the function expects an unsigned long.

#include <Rainbowduino.h>


void setup()
{
  Rb.init(); //initialize Rainbowduino driver
}
int Delay=10,intensity=255;
int r=0,g=0,b=intensity,x=0,y=0,RGB=0;
void loop()
{
  while (r<intensity)
  {
    RGB=((r*65536)+(g*256)+b);
    String colorString=String(RGB, HEX);
    Rb.fillRectangle(3,3,2,2,255,124,132);
    r++;
    b--;
    delay(Delay);
  }
}

I am assuming that's what you meant when you wanted me to input RGB. This is the error I get below. If I just input the variable RGB it just fades blue.

sketch_nov03b.ino: In function 'void loop()':
sketch_nov03b:16: error: no matching function for call to 'Rainbowduino::fillRectangle(int, int, int, int, int, int, int)'
C:\Users\Ryan\Documents\Arduino\libraries\Rainbowduino/Rainbowduino.h:80: note: candidates are: void Rainbowduino::fillRectangle(unsigned int, unsigned int, unsigned int, unsigned int, uint32_t)

Sorry, but what is an unsigned long? I am relatively new to coding and arduino, and there is very little documentation on the rainbowduino.

If I just input the variable RGB it just fades blue.

Because RGB is the wrong type. It needs to be unsigned long.

Surgikill:
I am assuming that's what you meant when you wanted me to input RGB. This is the error I get below. If I just input the variable RGB it just fades blue.

No. First GET RID OF THE STRING. You don't need it.

What I meant was to put RGB in the statement, like Rb.fillRectangle(3,3,2,2,RGB);, but I also mentioned that it depends on what data type RGB is. It MUST be the data type specifired for the fillRectangle() function, which is an unsigned long.

Try this...
At the top of your code, just above setup(), place this..

unsigned long color;

Then change loop()

void loop()
{
  while (r<intensity)
  {
    color=((r*65536)+(g*256)+b);
    Rb.fillRectangle(3,3,2,2,color);
    r++;
    b--;
    delay(Delay);
  }

An unsigned long is a 32 bit integer that cannot be a negative number. Data types are very important, and you need to learn what each one is, as well as learning what data tpes each function you use will take.

I have another problem. When r=0, it displays white. Here is what my code looks like;

#include <Rainbowduino.h>

void setup()
{
  Rb.init(); //initialize Rainbowduino driver
}
int Delay=10,intensity=255;
int r=0,g=0,b=intensity;
unsigned long color;
void loop()
{
  while (r<intensity)
  {
    color=((r*65536)+(g*256)+b);
    Rb.fillRectangle(3,3,2,2,color);
    r++;
    b--;
    delay(Delay);
  }
   while (g<intensity)
  {
    color=((r*65536)+(g*256)+b);
    Rb.fillRectangle(3,3,2,2,color);
    g++;
    r--;
    delay(Delay);
  }
  while (b<intensity)
  {
    color=((r*65536)+(g*256)+b);
    Rb.fillRectangle(3,3,2,2,color);    
    delay(Delay);
    b++;
    g--;    
  }
}

I think I could get around this by never letting any integer = 0 but there has to be a better way.

Try this:
color=((r65536UL)+(g256UL)+b);