0

I'm pretty new at Arduino and I'm trying to upload a sketch with IR sensor to control LED-s. I copy the code from internet,download library,I put my infrared codes for TV remote where I want and it says:"not declared in this scope"

Code and error:

#include <IRremote.h>

const int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
const int redPin = 6;
const int greenPin = 9;


void setup(){
  irrecv.enableIRIn();
  irrecv.blink13(true);
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
}

void loop(){
    if (irrecv.decode(&results)){

        switch(results.value){
          case E0E036C9: //Keypad button "5"
          digitalWrite(redPin, HIGH);
          delay(2000);
          digitalWrite(redPin, LOW);
          }

        switch(results.value){
          case E0E028D7: //Keypad button "2"
          digitalWrite(greenPin, HIGH);
          delay(2000);
          digitalWrite(greenPin, LOW);
          }

        irrecv.resume(); 
    }
}

Error:

C:\Users\Kandzija\Desktop\saneta\saneta.ino: In function 'void loop()':
saneta:21: error: 'E0E036C9' was not declared in this scope
           case E0E036C9: //Keypad button "5"
                ^
saneta:28: error: 'E0E028D7' was not declared in this scope
           case E0E028D7: //Keypad button "2"
                ^
exit status 1
'E0E036C9' was not declared in this scope

Can you help me guys pls? Thank You!

  • E0E036C0 ... What does suppose to means those values? constants? enums? – user31481 Nov 14 '17 at 19:47
2

Numeric values in HEX need to be prefixed with 0x:

case 0xE0E036C9: //Keypad button "5"

and

case 0xE0E028D7: //Keypad button "2"
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.