IRremote compiling error

Hi,

I'm stuck....a couple of years ago I was experimenting with (learning) about Arduinos and I wrote a short program to sort of play "Smoke on the water" (Deep Purple) when pressing a button on an old TV remote. It compiled, uploaded and worked.

2 years on I have tried to get it working again. "Exit Status 1" compiler error. and I can't figure out what I've done wrong. Arduino IDE has been updated and I'm using the 2.7 release of IRremote.

This is the error message:

"Tone.cpp.o (symbol from plugin): In function `timer0_pin_port':

(.text+0x0): multiple definition of `__vector_7'

C:\Users\B~1\AppData\Local\Temp\arduino_build_848743\libraries\IRremote\IRremote.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

Using library IRremote at version 2.7.0 in folder: C:\Users\Bla\Documents\Arduino\libraries\IRremote

exit status 1

Error compiling for board Arduino Uno"

What am I doing wrong?

Thanks

Ron

The built-in 'tone()' function and the IRRemote library both use the same timer. The IRRemote library seems to default to Timer2 but I think you can put:#define IR_USE_TIMER1
just above #include <IRRemote.h> to switch to Timer1.

Brilliant, thanks.

I see others have had the same problem and the solution is to find:

#define IR_USE_TIMER2 in IRremoteInt.h and change the default timer from TIMER2 to TIMER1.

All now working well.

Thanks

Ron

Hi,

All works, but only up to version 2.61 of IRremote. It compiles, uploads and works to Uno.

If I upgrade the version to 2.7 or 2.81 it compiles and loads ok but doesn't work.

Any ideas on what I'm doing wrong now?

#include <IRremote.h>
#define irPin 11
IRrecv irrecv(irPin);
decode_results results;

const int ledPin = 5;
int brightness = 10;
const int buzzer = 3;



void setup() {
   Serial.begin(9600);
   irrecv.enableIRIn();

   pinMode(ledPin, OUTPUT);
   pinMode(buzzer, OUTPUT);
   
}

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

       switch (results.value) {
         case 0x1000405:
            if(brightness < 255) {brightness = brightness+5;}
            analogWrite(ledPin, brightness);
            Serial.println(brightness);
            tone(buzzer, 1000); // Send 800Hz sound signal...
            delay(50);        // ...for 50ms
            noTone(buzzer);  
            delay(250);        
            break;

         case 0x1008485:
            if(brightness > 0) {brightness = brightness-5;}
            analogWrite(ledPin, brightness);
            Serial.println(brightness);
            tone(buzzer, 800); // Send 800Hz sound signal...
            delay(50);        // ...for 50ms
            noTone(buzzer); 
            delay(250);
            break;

         case 0x100BCBD:
            Serial.println("OFF");
            analogWrite(ledPin, 0);
            brightness = 20;
            tone(buzzer, 784); // Send G5 sound signal...
            delay(600);        // ...for 200ms
            tone(buzzer, 932); // Send Bb5 sound signal...
            delay(600);        // ...for 200ms
            tone(buzzer, 1046); // Send C6 sound signal...
            delay(800);        // ...for 200ms
            tone(buzzer, 784); // Send G5 sound signal...
            delay(600);        // ...for 200ms
            tone(buzzer, 932); // Send Bb5 sound signal...
            delay(500);        // ...for 200ms
            tone(buzzer, 1109); // Send Db6 sound signal...
            delay(300);        // ...for 200ms
            tone(buzzer, 1046); // Send C6 sound signal...
            delay(1200);        // ...for 200ms
            tone(buzzer, 784); // Send G5 sound signal...
            delay(600);        // ...for 200ms
            tone(buzzer, 932); // Send Bb5 sound signal...
            delay(600);        // ...for 200ms
            tone(buzzer, 1046); // Send C6 sound signal...
            delay(800);        // ...for 200ms
            tone(buzzer, 932); // Send G5 sound signal...
            delay(600);        // ...for 200ms
            tone(buzzer, 784); // Send G5 sound signal...
            delay(150);        // ...for 200ms
            noTone(buzzer);
            delay(100);        // ...for 200ms
            tone(buzzer, 784); // Send G5 sound signal...
            delay(1600);        // ...for 200ms
            noTone(buzzer); 
           
            break;
         }
   irrecv.resume();
   }
}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.