0

I have an IR Receiver hooked up to digital pin 10 on my Sparkfun RedBoard Artemis and I want to decode IR signals coming from a TV remote.

I have the following code:

#include <IRremote.h>

int IRpin = 10;
IRrecv irrecv(IRpin);
decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() 
{
  if (irrecv.decode(&results)) 
    {
      Serial.println(results.value, DEC); // Print the Serial 'results.value'
      irrecv.resume();   // Receive the next value
    }


}

However, the IRremote library is not compiling, and I'm getting the following error message:

Arduino: 1.8.9 (Windows 10), Board: "SparkFun BlackBoard Artemis, 921600, SparkFun Variable Loader (Recommended)"

C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp: In member function 'void IRrecv::enableIRIn()':
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:136:2: error: 'cli' was not declared in this scope
  cli();
  ^~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:136:2: note: suggested alternative: 'cbi'
  cli();
  ^~~
  cbi
In file included from C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\IRremoteInt.h:111,
                 from C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\IRremote.h:24,
                 from C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:1:
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:184:3: error: 'TCCR2A' was not declared in this scope
   TCCR2A = _BV(WGM21); \
   ^~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:141:2: note: in expansion of macro 'TIMER_CONFIG_NORMAL'
  TIMER_CONFIG_NORMAL();
  ^~~~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:184:16: error: 'WGM21' was not declared in this scope
   TCCR2A = _BV(WGM21); \
                ^~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:141:2: note: in expansion of macro 'TIMER_CONFIG_NORMAL'
  TIMER_CONFIG_NORMAL();
  ^~~~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:184:12: error: '_BV' was not declared in this scope
   TCCR2A = _BV(WGM21); \
            ^~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:141:2: note: in expansion of macro 'TIMER_CONFIG_NORMAL'
  TIMER_CONFIG_NORMAL();
  ^~~~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:185:3: error: 'TCCR2B' was not declared in this scope
   TCCR2B = _BV(CS21); \
   ^~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:141:2: note: in expansion of macro 'TIMER_CONFIG_NORMAL'
  TIMER_CONFIG_NORMAL();
  ^~~~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:185:16: error: 'CS21' was not declared in this scope
   TCCR2B = _BV(CS21); \
                ^~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:141:2: note: in expansion of macro 'TIMER_CONFIG_NORMAL'
  TIMER_CONFIG_NORMAL();
  ^~~~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:185:16: note: suggested alternative: '._21'
   TCCR2B = _BV(CS21); \
                ^~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:141:2: note: in expansion of macro 'TIMER_CONFIG_NORMAL'
  TIMER_CONFIG_NORMAL();
  ^~~~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:186:3: error: 'OCR2A' was not declared in this scope
   OCR2A  = TIMER_COUNT_TOP / 8; \
   ^~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:141:2: note: in expansion of macro 'TIMER_CONFIG_NORMAL'
  TIMER_CONFIG_NORMAL();
  ^~~~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:172:36: warning: integer overflow in expression of type 'long int' results in '-1894967296' [-Woverflow]
 #define TIMER_COUNT_TOP  (SYSCLOCK * USECPERTICK / 1000000)
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:186:12: note: in expansion of macro 'TIMER_COUNT_TOP'
   OCR2A  = TIMER_COUNT_TOP / 8; \
            ^~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:141:2: note: in expansion of macro 'TIMER_CONFIG_NORMAL'
  TIMER_CONFIG_NORMAL();
  ^~~~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:187:3: error: 'TCNT2' was not declared in this scope
   TCNT2  = 0; \
   ^~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:141:2: note: in expansion of macro 'TIMER_CONFIG_NORMAL'
  TIMER_CONFIG_NORMAL();
  ^~~~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:160:30: error: 'TIMSK2' was not declared in this scope
 #define TIMER_ENABLE_INTR   (TIMSK2 = _BV(OCIE2A))
                              ^~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:144:2: note: in expansion of macro 'TIMER_ENABLE_INTR'
  TIMER_ENABLE_INTR;
  ^~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:160:43: error: 'OCIE2A' was not declared in this scope
 #define TIMER_ENABLE_INTR   (TIMSK2 = _BV(OCIE2A))
                                           ^~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:144:2: note: in expansion of macro 'TIMER_ENABLE_INTR'
  TIMER_ENABLE_INTR;
  ^~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\IRremote.cpp:129:5: error: expected constructor, destructor, or type conversion before '(' token
 ISR (TIMER_INTR_NAME)
     ^
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:160:39: error: '_BV' was not declared in this scope
 #define TIMER_ENABLE_INTR   (TIMSK2 = _BV(OCIE2A))
                                       ^~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:144:2: note: in expansion of macro 'TIMER_ENABLE_INTR'
  TIMER_ENABLE_INTR;
  ^~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:148:2: error: 'sei' was not declared in this scope
  sei();  // enable interrupts
  ^~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irRecv.cpp:148:2: note: suggested alternative: 'sbi'
  sei();  // enable interrupts
  ^~~
  sbi
In file included from C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\IRremoteInt.h:111,
                 from C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\IRremote.h:24,
                 from C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:1:
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp: In member function 'void IRsend::mark(unsigned int)':
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:158:30: error: 'TCCR2A' was not declared in this scope
 #define TIMER_ENABLE_PWM    (TCCR2A |= _BV(COM2B1))
                              ^~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:24:2: note: in expansion of macro 'TIMER_ENABLE_PWM'
  TIMER_ENABLE_PWM; // Enable pin 3 PWM output
  ^~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:158:44: error: 'COM2B1' was not declared in this scope
 #define TIMER_ENABLE_PWM    (TCCR2A |= _BV(COM2B1))
                                            ^~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:24:2: note: in expansion of macro 'TIMER_ENABLE_PWM'
  TIMER_ENABLE_PWM; // Enable pin 3 PWM output
  ^~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:158:44: note: suggested alternative: 'IOM2'
 #define TIMER_ENABLE_PWM    (TCCR2A |= _BV(COM2B1))
                                            ^~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:24:2: note: in expansion of macro 'TIMER_ENABLE_PWM'
  TIMER_ENABLE_PWM; // Enable pin 3 PWM output
  ^~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:158:40: error: '_BV' was not declared in this scope
 #define TIMER_ENABLE_PWM    (TCCR2A |= _BV(COM2B1))
                                        ^~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:24:2: note: in expansion of macro 'TIMER_ENABLE_PWM'
  TIMER_ENABLE_PWM; // Enable pin 3 PWM output
  ^~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp: In member function 'void IRsend::space(unsigned int)':
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:159:30: error: 'TCCR2A' was not declared in this scope
 #define TIMER_DISABLE_PWM   (TCCR2A &= ~(_BV(COM2B1)))
                              ^~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:35:2: note: in expansion of macro 'TIMER_DISABLE_PWM'
  TIMER_DISABLE_PWM; // Disable pin 3 PWM output
  ^~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:159:46: error: 'COM2B1' was not declared in this scope
 #define TIMER_DISABLE_PWM   (TCCR2A &= ~(_BV(COM2B1)))
                                              ^~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:35:2: note: in expansion of macro 'TIMER_DISABLE_PWM'
  TIMER_DISABLE_PWM; // Disable pin 3 PWM output
  ^~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:159:46: note: suggested alternative: 'IOM2'
 #define TIMER_DISABLE_PWM   (TCCR2A &= ~(_BV(COM2B1)))
                                              ^~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:35:2: note: in expansion of macro 'TIMER_DISABLE_PWM'
  TIMER_DISABLE_PWM; // Disable pin 3 PWM output
  ^~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:159:42: error: '_BV' was not declared in this scope
 #define TIMER_DISABLE_PWM   (TCCR2A &= ~(_BV(COM2B1)))
                                          ^~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:35:2: note: in expansion of macro 'TIMER_DISABLE_PWM'
  TIMER_DISABLE_PWM; // Disable pin 3 PWM output
  ^~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp: In member function 'void IRsend::enableIROut(int)':
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:161:30: error: 'TIMSK2' was not declared in this scope
 #define TIMER_DISABLE_INTR  (TIMSK2 = 0)
                              ^~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:60:2: note: in expansion of macro 'TIMER_DISABLE_INTR'
  TIMER_DISABLE_INTR; //Timer2 Overflow Interrupt
  ^~~~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:166:2: error: 'TCCR2A' was not declared in this scope
  TCCR2A               = _BV(WGM20); \
  ^~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:70:2: note: in expansion of macro 'TIMER_CONFIG_KHZ'
  TIMER_CONFIG_KHZ(khz);
  ^~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:166:29: error: 'WGM20' was not declared in this scope
  TCCR2A               = _BV(WGM20); \
                             ^~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:70:2: note: in expansion of macro 'TIMER_CONFIG_KHZ'
  TIMER_CONFIG_KHZ(khz);
  ^~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:166:25: error: '_BV' was not declared in this scope
  TCCR2A               = _BV(WGM20); \
                         ^~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:70:2: note: in expansion of macro 'TIMER_CONFIG_KHZ'
  TIMER_CONFIG_KHZ(khz);
  ^~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:167:2: error: 'TCCR2B' was not declared in this scope
  TCCR2B               = _BV(WGM22) | _BV(CS20); \
  ^~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:70:2: note: in expansion of macro 'TIMER_CONFIG_KHZ'
  TIMER_CONFIG_KHZ(khz);
  ^~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:167:29: error: 'WGM22' was not declared in this scope
  TCCR2B               = _BV(WGM22) | _BV(CS20); \
                             ^~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:70:2: note: in expansion of macro 'TIMER_CONFIG_KHZ'
  TIMER_CONFIG_KHZ(khz);
  ^~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:167:42: error: 'CS20' was not declared in this scope
  TCCR2B               = _BV(WGM22) | _BV(CS20); \
                                          ^~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:70:2: note: in expansion of macro 'TIMER_CONFIG_KHZ'
  TIMER_CONFIG_KHZ(khz);
  ^~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:167:42: note: suggested alternative: '._20'
  TCCR2B               = _BV(WGM22) | _BV(CS20); \
                                          ^~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:70:2: note: in expansion of macro 'TIMER_CONFIG_KHZ'
  TIMER_CONFIG_KHZ(khz);
  ^~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:168:2: error: 'OCR2A' was not declared in this scope
  OCR2A                = pwmval; \
  ^~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:70:2: note: in expansion of macro 'TIMER_CONFIG_KHZ'
  TIMER_CONFIG_KHZ(khz);
  ^~~~~~~~~~~~~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\boarddefs.h:169:2: error: 'OCR2B' was not declared in this scope
  OCR2B                = pwmval / 3; \
  ^~~~~
C:\Users\Kirtan\Documents\Arduino\libraries\Arduino-IRremote-master\irSend.cpp:70:2: note: in expansion of macro 'TIMER_CONFIG_KHZ'
  TIMER_CONFIG_KHZ(khz);
  ^~~~~~~~~~~~~~~~
exit status 1
Error compiling for board SparkFun BlackBoard Artemis.

Does anyone know a fix or workaround to get the library to work with my board?

  • looks like the IR library is not written for the board that you are using – jsotola Sep 13 at 4:36

Your Answer

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

Browse other questions tagged or ask your own question.