Error Compiling for board Arduino/Genuio Uno

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
RPi_Zero
 
Posts: 6
Joined: Wed Sep 19, 2018 12:34 pm

Error Compiling for board Arduino/Genuio Uno

Post by RPi_Zero »

I am trying to make a script that allows me to change the duration and tone of a speaker using and IR remote. For some reason I keep getting a Error Compiling for board Arduino/Genuio Uno error. Here's my code:

Code: Select all

// Include IR Remote Library by Ken Shirriff
#include <IRremote.h>
 
// Define sensor pin
const int RECV_PIN = 9;
  
// Define integer to remember toggle state
int togglestate = 0;
int duration = 500;
int soundTone = 500;
 
// Define IR Receiver and Results Objects
IRrecv irrecv(RECV_PIN);
decode_results results;
 
 
void setup(){
  // Enable the IR Receiver
  irrecv.enableIRIn();
  // Set LED pins as Outputs
  pinMode(8, OUTPUT);
}
 
 
void loop(){

    if (togglestate == 1){
      tone(8,soundTone);
      delay(duration);
      noTone(8);
      delay(duration);}
    else{
      noTone(8);}

    if (irrecv.decode(&results)){
 
        switch(results.value){
          
          case 0x3AFB26D4: //Down Button
        if(soundTone > 50){
          soundTone = soundTone - 50;
          delay(100);}
        else{
          soundTone = soundTone;
          delay(100);}
        break;
          
          case 0xE246AFCA: //Up Button
        if (soundTone < 55){
          soundTone = soundTone + 50;
          delay(100);}
        else{
          soundTone = soundTone;
          delay(100);}
        break;

          case 0x4D43596A:  //Left Button
        if (duration > 0){
          duration = duration - 100;
          delay(100);}
        else{
          duration = duration;
          delay(100);}

          case 0xBB0EDD22:  //Right Button
        if (duration < 1500){
          duration = duration + 100;
          delay(100);}
        else{
          duration = duration;
          delay(100);}
   
          case 0x406A954D: //Power Button
        if(togglestate==0){
          togglestate = 1;
          delay(300);}
        else {
          togglestate = 0;
          delay(300);}
        break;
        
    }
    irrecv.resume(); 
  }
 
}
Here's the error:

Code: Select all

Arduino: 1.8.7 (Windows 8.1), Board: "Arduino/Genuino Uno"

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

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

libraries\IRremote\IRremote.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Uno.
Any help would be awesome. Thanks!

User avatar
adafruit2
 
Posts: 22111
Joined: Fri Mar 11, 2005 7:36 pm

Re: Error Compiling for board Arduino/Genuio Uno

Post by adafruit2 »

see if you need to update IRRemote, looks like it no longer compiles due to arduino changes?

User avatar
RPi_Zero
 
Posts: 6
Joined: Wed Sep 19, 2018 12:34 pm

Re: Error Compiling for board Arduino/Genuio Uno

Post by RPi_Zero »

But any other IRRemote script that I have made works fine. Far as I can tell, IRRemote and tone() are clashing. But I am not sure.
Plus I just installed the library less than two weeks ago with the latest version.

User avatar
adafruit2
 
Posts: 22111
Joined: Fri Mar 11, 2005 7:36 pm

Re: Error Compiling for board Arduino/Genuio Uno

Post by adafruit2 »

cant use tone then!

User avatar
RPi_Zero
 
Posts: 6
Joined: Wed Sep 19, 2018 12:34 pm

Re: Error Compiling for board Arduino/Genuio Uno

Post by RPi_Zero »

Hmmm....

But then how to make a tone?

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”