user39257: Basically what i am trying to do is use an ir remote to turn an rgb on/off and have a few preset colors as well as being able to increase/decrease red/green/blue independently. I don't know much about C/C++ so this is really hard to troubleshoot.
#include <IRremote.h>

int rbright;
int gbright;
int bbright;
int before;
int RECV_PIN=12; //data out of IR receiver connects to pin 12
int redPin=11;
int greenPin=10;
int bluePin=9;
int steps=5;
IRrecv irrecv(RECV_PIN);
decode_results results;

//uncomment this line if using a Common Anode LED
#define COMMON_ANODE

void setup()
{
    before=0;
    rbright=80;
    gbright=0;
    bbright=80;
    irrecv.enableIRIn(); // start the receiver
    pinMode(redPin, OUTPUT);
    pinMode(greenPin, OUTPUT);
    pinMode(bluePin, OUTPUT);
}

void loop()
{
    if (irrecv.decode(&results)) {
        if (results.value==B54A3AC5){ //Code to turn the LED ON/OFF
            if(before==0){ // if the LED was turned off, then we turn it on
                digitalWrite(redpin,HIGH);
                digitalWrite(greenpin,HIGH);
                digitalWrite(bluepin,HIGH);
                before=1; //LED is now turned on
            }
            else{
                digitalWrite(redpin,LOW);
                digitalWrite(greenpin,LOW);
                digitalWrite(bluepin,LOW); //if the LED was turned on, then we turn it off
                before=0;
            }
        }
        if (results.value==B54A8A75 && before==1){ //Code to decrease the red
            if(rbright-255/steps<0){
                analogWrite(redpin,rbright);
            }
            else{
                rbright=rbright-255/steps;
                analogWrite(redpin,rbright);
            }
        }
        if (results.value==B54A7A85 && before==1){ //Code to increase the red
            if(rbright+255/steps>255){
                analogWrite(redpin,rbright);
            }
            else{
                rbright=rbright+255/steps;
                analogWrite(redpin,rbright);
            }
        }
        if (results.value==B54AB24D && before==1){ //Code to decrease the green
            if(gbright-255/steps<0){
                analogWrite(greenpin,gbright);
            }
            else{
                gbright=gbright-255/steps;
                analogWrite(greenpin,gbright);
            }
        }
        if (results.value==B54A32CD && before==1){ //Code to increase the green
            if(gbright+255/steps>255){
                analogWrite(greenpin,gbright);
            }
            else{
                gbright=gbright+255/steps;
                analogWrite(greenpin,gbright);
            }
        }
        if (results.value==B54A0AF5 && before==1){ //Code to decrease the blue
            if(bbright-255/steps<0){
                analogWrite(bluepin,bbright);
            }
            else{
                bbright=bbright-255/steps;
                analogWrite(bluepin,bbright);
            }
        }
        if (results.value==B54ACA35 && before==1){ //Code to increase the blue
            if(bbright+255/steps>255){
                analogWrite(bluepin,bbright);
            }
            else{
                bbright=bbright+255/steps;
                analogWrite(bluepin,bbright);
            }
        }
        if (results.value==B54AA956 && before==1){ //Code yellow
            setColor(255, 255, 0);
        }
        if (results.value==B54A2AD5 && before==1){ //Code purple
            setColor(80, 0, 80);
        }
        if (results.value==B54AEA15 && before==1){ //Code aqua
            setColor(0, 255, 255);
        }
        irrecv.resume();
    }

void setColor(int red, int green, int blue)
{
#ifdef COMMON_ANODE
    red = 255 - red;
    green = 255 - green;
    blue = 255 - blue;
#endif
    analogWrite(redPin, red);
    analogWrite(greenPin, green);
    analogWrite(bluePin, blue);
}

The errors i get are

rgbcontrolir_ino.ino: In function ‘void loop()’:
  rgbcontrolir_ino.ino:35:24: error: ‘B54A3AC5’ was not declared in this scope
  rgbcontrolir_ino.ino:37:20: error: ‘redpin’ was not declared in this scope
  rgbcontrolir_ino.ino:38:20: error: ‘greenpin’ was not declared in this scope
  rgbcontrolir_ino.ino:39:20: error: ‘bluepin’ was not declared in this scope
  rgbcontrolir_ino.ino:43:20: error: ‘redpin’ was not declared in this scope
  rgbcontrolir_ino.ino:44:20: error: ‘greenpin’ was not declared in this scope
  rgbcontrolir_ino.ino:45:20: error: ‘bluepin’ was not declared in this scope
  rgbcontrolir_ino.ino:48:22: error: ‘B54A8A75’ was not declared in this scope
  rgbcontrolir_ino.ino:50:19: error: ‘redpin’ was not declared in this scope
  rgbcontrolir_ino.ino:54:17: error: ‘redpin’ was not declared in this scope
  rgbcontrolir_ino.ino:56:22: error: ‘B54A7A85’ was not declared in this scope
  rgbcontrolir_ino.ino:58:19: error: ‘redpin’ was not declared in this scope
  rgbcontrolir_ino.ino:62:17: error: ‘redpin’ was not declared in this scope
  rgbcontrolir_ino.ino:64:22: error: ‘B54AB24D’ was not declared in this scope
  rgbcontrolir_ino.ino:66:19: error: ‘greenpin’ was not declared in this scope
  rgbcontrolir_ino.ino:70:17: error: ‘greenpin’ was not declared in this scope
  rgbcontrolir_ino.ino:72:22: error: ‘B54A32CD’ was not declared in this scope
  rgbcontrolir_ino.ino:74:19: error: ‘greenpin’ was not declared in this scope
  rgbcontrolir_ino.ino:78:17: error: ‘greenpin’ was not declared in this scope
  rgbcontrolir_ino.ino:80:22: error: ‘B54A0AF5’ was not declared in this scope
  rgbcontrolir_ino.ino:82:19: error: ‘bluepin’ was not declared in this scope
  rgbcontrolir_ino.ino:86:17: error: ‘bluepin’ was not declared in this scope
  rgbcontrolir_ino.ino:88:22: error: ‘B54ACA35’ was not declared in this scope
  rgbcontrolir_ino.ino:90:19: error: ‘bluepin’ was not declared in this scope
  rgbcontrolir_ino.ino:94:17: error: ‘bluepin’ was not declared in this scope
  rgbcontrolir_ino.ino:96:22: error: ‘B54AA956’ was not declared in this scope
  rgbcontrolir_ino.ino:100:24: error: ‘B54A2AD5’ was not declared in this scope
  rgbcontrolir_ino.ino:104:24: error: ‘B54AEA15’ was not declared in this scope
  rgbcontrolir_ino.ino:112:5: error: a function-definition is not allowed here before ‘{’ token
  rgbcontrolir_ino.ino:121:5: error: expected ‘}’ at end of input


user7508: The errors are self-explanatory. You just have to read them carefully.

‘B54A3AC5’ was not declared in this scope

The compiler doesn't know what "B54A3AC5" means. Nor do I, but I gess
you may mean an hexadecimal 32-bit value. If that's the case, write it
with the prefix "0x", as in 0xb54a3ac5.

‘redpin’ was not declared in this scope

Same thing, it doesn't know what "redpin" is. Oh, wait, you have
declared a variable named redPin. Maybe that is what you meant:
"redPin", with an uppercase "P".

a function-definition is not allowed here before ‘{’ token

You tried to define setColor() within the loop() function. You
cannot define a function within a function in C++ (well, you can have
lambdas, but that's irrelevant to your problem).
Had you tried to indent your code properly (like I did in my edit), the
error would have been obvious: there is no closing brace to match the
opening one at the start of loop().

expected ‘}’ at end of input

Another symptom of the problem above.

Edit: After reading your code, I have a few suggestions for making
it clearer are more efficient:

Declare all the constants with the const keyword, at the beginning
of your program. A common convention is to write them in all caps
with underscores, to distinguish them from variables.
Avoid "magic numbers" within your code (e.g. the IR codes), and use
properly named constants instead.
before is hard to understand, give it a name that makes sense. I
suggest leds_are_on. And make it a bool, because it can only be
either true or false.
One way to avoid deeply nested loops is to use return statements to
get out of loop() as soon as you know you have nothing to do.

With these suggestions, I would start the program like this:
#include <IRremote.h>

// Pinout.
const int RECV_PIN  = 12;  // data out of IR receiver
const int RED_PIN   = 11;
const int GREEN_PIN = 10;
const int BLUE_PIN  = 9;

// Number of steps between black and full brightness.
const int STEPS     = 5;

// IR codes.
const uint32_t CODE_ON_OFF     = 0xb54a3ac5;
const uint32_t CODE_LESS_RED   = 0xb54a8a75;
const uint32_t CODE_MORE_RED   = 0xb54a7a85;
const uint32_t CODE_LESS_GREEN = 0xb54ab24d;
const uint32_t CODE_MORE_GREEN = 0xb54a32cd;
const uint32_t CODE_LESS_BLUE  = 0xb54a0af5;
const uint32_t CODE_MORE_BLUE  = 0xb54aca35;
const uint32_t CODE_YELLOW     = 0xb54aa956;
const uint32_t CODE_PURPLE     = 0xb54a2ad5;
const uint32_t CODE_AQUA       = 0xb54aea15;

bool leds_are_on;
int r_bright;
int g_bright;
int b_bright;
IRrecv irrecv(RECV_PIN);

and the loop() would be like this:
void loop()
{
    decode_results results;
    if (!irrecv.decode(&results))
        return;

    // If the LEDs are OFF, the only valid action is to turn them
    // ON.
    if (!leds_are_on) {
        if (results.value == CODE_ON_OFF) {
            digitalWrite(RED_PIN,   HIGH);
            digitalWrite(GREEN_PIN, HIGH);
            digitalWrite(BLUE_PIN,  HIGH);
            leds_are_on = true;
        }
        irrecv.resume();
        return;
    }

    // The LEDs are ON: all codes are valid.
    switch (results.value) {
        case CODE_ON_OFF:  // turn OFF
            digitalWrite(RED_PIN,   LOW);
            digitalWrite(GREEN_PIN, LOW);
            digitalWrite(BLUE_PIN,  LOW);
            leds_are_on = false;
            break;
        case CODE_LESS_RED:
            r_bright = constrain(r_bright - 255/steps, 0, 255);
            analogWrite(RED_PIN, r_bright);
            break;
        case CODE_MORE_RED:
            r_bright = constrain(r_bright + 255/steps, 0, 255);
            analogWrite(RED_PIN, r_bright);
            break;
        // etc...
    }
    irrecv.resume();
}


39257: <p>Basically what i am trying to do is use an ir remote to turn an rgb on/off and have a few preset colors as well as being able to increase/decrease red/green/blue independently. I don't know much about C/C++ so this is really hard to troubleshoot.</p>

<pre class="lang-c++ prettyprint-override"><code>#include &lt;IRremote.h&gt;

int rbright;
int gbright;
int bbright;
int before;
int RECV_PIN=12; //data out of IR receiver connects to pin 12
int redPin=11;
int greenPin=10;
int bluePin=9;
int steps=5;
IRrecv irrecv(RECV_PIN);
decode_results results;

//uncomment this line if using a Common Anode LED
#define COMMON_ANODE

void setup()
{
    before=0;
    rbright=80;
    gbright=0;
    bbright=80;
    irrecv.enableIRIn(); // start the receiver
    pinMode(redPin, OUTPUT);
    pinMode(greenPin, OUTPUT);
    pinMode(bluePin, OUTPUT);
}

void loop()
{
    if (irrecv.decode(&amp;results)) {
        if (results.value==B54A3AC5){ //Code to turn the LED ON/OFF
            if(before==0){ // if the LED was turned off, then we turn it on
                digitalWrite(redpin,HIGH);
                digitalWrite(greenpin,HIGH);
                digitalWrite(bluepin,HIGH);
                before=1; //LED is now turned on
            }
            else{
                digitalWrite(redpin,LOW);
                digitalWrite(greenpin,LOW);
                digitalWrite(bluepin,LOW); //if the LED was turned on, then we turn it off
                before=0;
            }
        }
        if (results.value==B54A8A75 &amp;&amp; before==1){ //Code to decrease the red
            if(rbright-255/steps&lt;0){
                analogWrite(redpin,rbright);
            }
            else{
                rbright=rbright-255/steps;
                analogWrite(redpin,rbright);
            }
        }
        if (results.value==B54A7A85 &amp;&amp; before==1){ //Code to increase the red
            if(rbright+255/steps&gt;255){
                analogWrite(redpin,rbright);
            }
            else{
                rbright=rbright+255/steps;
                analogWrite(redpin,rbright);
            }
        }
        if (results.value==B54AB24D &amp;&amp; before==1){ //Code to decrease the green
            if(gbright-255/steps&lt;0){
                analogWrite(greenpin,gbright);
            }
            else{
                gbright=gbright-255/steps;
                analogWrite(greenpin,gbright);
            }
        }
        if (results.value==B54A32CD &amp;&amp; before==1){ //Code to increase the green
            if(gbright+255/steps&gt;255){
                analogWrite(greenpin,gbright);
            }
            else{
                gbright=gbright+255/steps;
                analogWrite(greenpin,gbright);
            }
        }
        if (results.value==B54A0AF5 &amp;&amp; before==1){ //Code to decrease the blue
            if(bbright-255/steps&lt;0){
                analogWrite(bluepin,bbright);
            }
            else{
                bbright=bbright-255/steps;
                analogWrite(bluepin,bbright);
            }
        }
        if (results.value==B54ACA35 &amp;&amp; before==1){ //Code to increase the blue
            if(bbright+255/steps&gt;255){
                analogWrite(bluepin,bbright);
            }
            else{
                bbright=bbright+255/steps;
                analogWrite(bluepin,bbright);
            }
        }
        if (results.value==B54AA956 &amp;&amp; before==1){ //Code yellow
            setColor(255, 255, 0);
        }
        if (results.value==B54A2AD5 &amp;&amp; before==1){ //Code purple
            setColor(80, 0, 80);
        }
        if (results.value==B54AEA15 &amp;&amp; before==1){ //Code aqua
            setColor(0, 255, 255);
        }
        irrecv.resume();
    }

void setColor(int red, int green, int blue)
{
#ifdef COMMON_ANODE
    red = 255 - red;
    green = 255 - green;
    blue = 255 - blue;
#endif
    analogWrite(redPin, red);
    analogWrite(greenPin, green);
    analogWrite(bluePin, blue);
}
</code></pre>

<p>The errors i get are</p>

<blockquote>
  <p>rgbcontrolir_ino.ino: In function ‘void loop()’:<br>
  rgbcontrolir_ino.ino:35:24: error: ‘B54A3AC5’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:37:20: error: ‘redpin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:38:20: error: ‘greenpin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:39:20: error: ‘bluepin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:43:20: error: ‘redpin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:44:20: error: ‘greenpin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:45:20: error: ‘bluepin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:48:22: error: ‘B54A8A75’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:50:19: error: ‘redpin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:54:17: error: ‘redpin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:56:22: error: ‘B54A7A85’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:58:19: error: ‘redpin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:62:17: error: ‘redpin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:64:22: error: ‘B54AB24D’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:66:19: error: ‘greenpin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:70:17: error: ‘greenpin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:72:22: error: ‘B54A32CD’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:74:19: error: ‘greenpin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:78:17: error: ‘greenpin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:80:22: error: ‘B54A0AF5’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:82:19: error: ‘bluepin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:86:17: error: ‘bluepin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:88:22: error: ‘B54ACA35’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:90:19: error: ‘bluepin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:94:17: error: ‘bluepin’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:96:22: error: ‘B54AA956’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:100:24: error: ‘B54A2AD5’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:104:24: error: ‘B54AEA15’ was not declared in this scope<br>
  rgbcontrolir_ino.ino:112:5: error: a function-definition is not allowed here before ‘{’ token<br>
  rgbcontrolir_ino.ino:121:5: error: expected ‘}’ at end of input</p>
</blockquote>
 7508: <p>The errors are self-explanatory. You just have to read them carefully.</p>

<blockquote>
  <p>‘B54A3AC5’ was not declared in this scope</p>
</blockquote>

<p>The compiler doesn't know what "B54A3AC5" means. Nor do I, but I <em>gess</em>
you may mean an hexadecimal 32-bit value. If that's the case, write it
with the prefix "0x", as in <code>0xb54a3ac5</code>.</p>

<blockquote>
  <p>‘redpin’ was not declared in this scope</p>
</blockquote>

<p>Same thing, it doesn't know what "redpin" is. Oh, wait, you have
declared a variable named <code>redPin</code>. Maybe that is what you meant:
"redPin", with an uppercase "P".</p>

<blockquote>
  <p>a function-definition is not allowed here before ‘{’ token</p>
</blockquote>

<p>You tried to define <code>setColor()</code> <em>within</em> the <code>loop()</code> function. You
cannot define a function within a function in C++ (well, you can have
lambdas, but that's irrelevant to your problem).</p>

<p>Had you tried to indent your code properly (like I did in my edit), the
error would have been obvious: there is no closing brace to match the
opening one at the start of <code>loop()</code>.</p>

<blockquote>
  <p>expected ‘}’ at end of input</p>
</blockquote>

<p>Another symptom of the problem above.</p>

<hr>

<p><strong>Edit</strong>: After reading your code, I have a few suggestions for making
it clearer are more efficient:</p>

<ol>
<li>Declare all the constants with the <code>const</code> keyword, at the beginning
of your program. A common convention is to write them in all caps
with underscores, to distinguish them from variables.</li>
<li>Avoid "magic numbers" within your code (e.g. the IR codes), and use
properly named constants instead.</li>
<li><code>before</code> is hard to understand, give it a name that makes sense. I
suggest <code>leds_are_on</code>. And make it a <code>bool</code>, because it can only be
either <code>true</code> or <code>false</code>.</li>
<li>One way to avoid deeply nested loops is to use <code>return</code> statements to
get out of <code>loop()</code> as soon as you know you have nothing to do.</li>
</ol>

<p>With these suggestions, I would start the program like this:</p>



<pre class="lang-c++ prettyprint-override"><code>#include &lt;IRremote.h&gt;

// Pinout.
const int RECV_PIN  = 12;  // data out of IR receiver
const int RED_PIN   = 11;
const int GREEN_PIN = 10;
const int BLUE_PIN  = 9;

// Number of steps between black and full brightness.
const int STEPS     = 5;

// IR codes.
const uint32_t CODE_ON_OFF     = 0xb54a3ac5;
const uint32_t CODE_LESS_RED   = 0xb54a8a75;
const uint32_t CODE_MORE_RED   = 0xb54a7a85;
const uint32_t CODE_LESS_GREEN = 0xb54ab24d;
const uint32_t CODE_MORE_GREEN = 0xb54a32cd;
const uint32_t CODE_LESS_BLUE  = 0xb54a0af5;
const uint32_t CODE_MORE_BLUE  = 0xb54aca35;
const uint32_t CODE_YELLOW     = 0xb54aa956;
const uint32_t CODE_PURPLE     = 0xb54a2ad5;
const uint32_t CODE_AQUA       = 0xb54aea15;

bool leds_are_on;
int r_bright;
int g_bright;
int b_bright;
IRrecv irrecv(RECV_PIN);
</code></pre>

<p>and the <code>loop()</code> would be like this:</p>

<pre class="lang-c++ prettyprint-override"><code>void loop()
{
    decode_results results;
    if (!irrecv.decode(&amp;results))
        return;

    // If the LEDs are OFF, the only valid action is to turn them
    // ON.
    if (!leds_are_on) {
        if (results.value == CODE_ON_OFF) {
            digitalWrite(RED_PIN,   HIGH);
            digitalWrite(GREEN_PIN, HIGH);
            digitalWrite(BLUE_PIN,  HIGH);
            leds_are_on = true;
        }
        irrecv.resume();
        return;
    }

    // The LEDs are ON: all codes are valid.
    switch (results.value) {
        case CODE_ON_OFF:  // turn OFF
            digitalWrite(RED_PIN,   LOW);
            digitalWrite(GREEN_PIN, LOW);
            digitalWrite(BLUE_PIN,  LOW);
            leds_are_on = false;
            break;
        case CODE_LESS_RED:
            r_bright = constrain(r_bright - 255/steps, 0, 255);
            analogWrite(RED_PIN, r_bright);
            break;
        case CODE_MORE_RED:
            r_bright = constrain(r_bright + 255/steps, 0, 255);
            analogWrite(RED_PIN, r_bright);
            break;
        // etc...
    }
    irrecv.resume();
}
</code></pre>
