Whatever else might be wrong, the semicolon at the end of this line will mean that the code intended to be executed if the values match will be executed unconditionally
As to other problems, where is FF18E7 declared ?
What value are you actually trying to match ? Is it 0xFF18E7 by any chance ?
Is the syntax using HEX == actually valid ?
Have you looked at the examples that come with the library ?
C:\Users\user\Documents\Arduino\notDone_-_IR_-_RGB\notDone_-_IR_-_RGB.ino:2:15: error: 'FF30CF' was not declared in this scope
const int R = FF30CF
^~~~~~
C:\Users\user\Documents\Arduino\notDone_-_IR_-_RGB\notDone_-_IR_-_RGB.ino: In function 'void setup()':
C:\Users\user\Documents\Arduino\notDone_-_IR_-_RGB\notDone_-_IR_-_RGB.ino:15:12: error: 'RED' was not declared in this scope
pinMode (RED, OUTPUT);
^~~
C:\Users\user\Documents\Arduino\notDone_-_IR_-_RGB\notDone_-_IR_-_RGB.ino: In function 'void loop()':
C:\Users\user\Documents\Arduino\notDone_-_IR_-_RGB\notDone_-_IR_-_RGB.ino:27:19: error: 'RED' was not declared in this scope
analogWrite(RED, 255);
^~~
C:\Users\user\Documents\Arduino\notDone_-_IR_-_RGB\notDone_-_IR_-_RGB.ino:33:19: error: 'RED' was not declared in this scope
analogWrite(RED, 255);
^~~
C:\Users\user\Documents\Arduino\notDone_-_IR_-_RGB\notDone_-_IR_-_RGB.ino:38:21: error: 'RED' was not declared in this scope
analogWrite(RED, 0);
^~~
exit status 1
Compilation error: 'FF30CF' was not declared in this scope
code (updated)
#include <IRremote.h>
const int R = FF30CF
const int G = FF18E7
const int RED = 7;
const int GREEN = 6;
const int BLUE = 5;
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
pinMode (RED, OUTPUT);
pinMode (GREEN, OUTPUT);
pinMode (BLUE, OUTPUT);
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
if (results.value == 0xFF30CF) {
analogWrite(RED, 255);
analogWrite(BLUE, 0);
analogWrite(GREEN, 0);
}
else {
if (results.value == 0xFF18E7) {
analogWrite(RED, 255);
analogWrite(BLUE, 0);
analogWrite(GREEN, 0);
}
else {
analogWrite(RED, 0);
analogWrite(GREEN, 0);
analogWrite(BLUE,255);
}
}
}
}