user47112: //Error message Arduino: 1.8.5 (Windows 10), Placa:"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
Erro ao compilar para a placa Arduino/Genuino Uno.

Este relatório teria mais informação com a
opção «Mostrar mensagens detalhadas durante a
compilação» seleccionada nas Preferências.
//

Code
#include <IRremote.h>      //must copy IRremote library to arduino libraries
#include <Servo.h>
#define plus 0xFD10EF   //clockwise rotation button
#define minus 0xFD50AF  //counter clockwise rotation button

int RECV_PIN = 2;       //IR receiver pin
Servo servo;
int val;                //rotation angle
bool cwRotation, ccwRotation;  //the states of rotation

IRrecv irrecv(RECV_PIN);

decode_results results;

const int pinoledlar=10;
int portaled4 = 12; 
int portaled3 = 8; 
int portaled2 = 11;
#define pinopir 3
int acionamento;
const int sirene=7;
int portaLDR = A5; //Porta analógica utilizada pelo LDR

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  servo.attach(9);     //servo pin
  pinMode(pinoledlar,OUTPUT);
  pinMode(portaled2, OUTPUT);
  pinMode(portaled3, OUTPUT);
  pinMode(portaled4, OUTPUT);
  pinMode(pinopir,INPUT);
  pinMode(sirene,OUTPUT);
}

void loop() 
{
    acionamento=digitalRead(pinopir);
    if (irrecv.decode(&results)) 
    {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value

    if (results.value == plus)
    {
      cwRotation = !cwRotation;      //toggle the rotation value
      ccwRotation = false;         //no rotation in this direction
    }

    if (results.value == minus)
    {
      ccwRotation = !ccwRotation;   //toggle the rotation value
      cwRotation = false;            //no rotation in this direction
    }
    }
    if (cwRotation && (val != 175))  
    {
    val++;                         //for colockwise button
    }
    if (ccwRotation && (val != 0))  
    {
    val--;                         //for counter colockwise button
    }
    servo.write(val);
    delay(20);          //General speed

    if (acionamento==HIGH)//se detetar movimento
    {
    digitalWrite(pinoledlar,LOW);
    tone(sirene,440,1000);
    delay(1500);
    }
    else// senão detetar movimento
    {
    digitalWrite(pinoledlar,HIGH);
    noTone(sirene);
    delay(1500);

    int estado = analogRead(portaLDR);  //Lê o valor fornecido pelo LDR  

    // Caso o valor lido na porta analógica seja maior do que 
    // 800, acende o LED  
    // Ajuste o valor abaixo de acordo com o seu circuito  
    if (estado > 900)    
    {  
    digitalWrite(portaled2, HIGH);
    digitalWrite(portaled3, HIGH);
    digitalWrite(portaled4, HIGH);
    }  
    else  //Caso contrário, apaga o led  
    {  
    digitalWrite(portaled2, LOW);
    digitalWrite(portaled3, LOW);
    digitalWrite(portaled4, LOW);
    }  
}  
}


user33871: You have a very common problem that is documented all over. You have two libraries, Servo and IRremote, that are both trying to use the same hardware timer. Do a little Google searching for possible fixes. You will need to either find a different Servo library or a different IRremote library.

47112: <pre><code>//Error message Arduino: 1.8.5 (Windows 10), Placa:"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
Erro ao compilar para a placa Arduino/Genuino Uno.

Este relatório teria mais informação com a
opção «Mostrar mensagens detalhadas durante a
compilação» seleccionada nas Preferências.
//
</code></pre>

<p>Code</p>

<pre><code>#include &lt;IRremote.h&gt;      //must copy IRremote library to arduino libraries
#include &lt;Servo.h&gt;
#define plus 0xFD10EF   //clockwise rotation button
#define minus 0xFD50AF  //counter clockwise rotation button

int RECV_PIN = 2;       //IR receiver pin
Servo servo;
int val;                //rotation angle
bool cwRotation, ccwRotation;  //the states of rotation

IRrecv irrecv(RECV_PIN);

decode_results results;

const int pinoledlar=10;
int portaled4 = 12; 
int portaled3 = 8; 
int portaled2 = 11;
#define pinopir 3
int acionamento;
const int sirene=7;
int portaLDR = A5; //Porta analógica utilizada pelo LDR

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  servo.attach(9);     //servo pin
  pinMode(pinoledlar,OUTPUT);
  pinMode(portaled2, OUTPUT);
  pinMode(portaled3, OUTPUT);
  pinMode(portaled4, OUTPUT);
  pinMode(pinopir,INPUT);
  pinMode(sirene,OUTPUT);
}

void loop() 
{
    acionamento=digitalRead(pinopir);
    if (irrecv.decode(&amp;results)) 
    {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value

    if (results.value == plus)
    {
      cwRotation = !cwRotation;      //toggle the rotation value
      ccwRotation = false;         //no rotation in this direction
    }

    if (results.value == minus)
    {
      ccwRotation = !ccwRotation;   //toggle the rotation value
      cwRotation = false;            //no rotation in this direction
    }
    }
    if (cwRotation &amp;&amp; (val != 175))  
    {
    val++;                         //for colockwise button
    }
    if (ccwRotation &amp;&amp; (val != 0))  
    {
    val--;                         //for counter colockwise button
    }
    servo.write(val);
    delay(20);          //General speed

    if (acionamento==HIGH)//se detetar movimento
    {
    digitalWrite(pinoledlar,LOW);
    tone(sirene,440,1000);
    delay(1500);
    }
    else// senão detetar movimento
    {
    digitalWrite(pinoledlar,HIGH);
    noTone(sirene);
    delay(1500);

    int estado = analogRead(portaLDR);  //Lê o valor fornecido pelo LDR  

    // Caso o valor lido na porta analógica seja maior do que 
    // 800, acende o LED  
    // Ajuste o valor abaixo de acordo com o seu circuito  
    if (estado &gt; 900)    
    {  
    digitalWrite(portaled2, HIGH);
    digitalWrite(portaled3, HIGH);
    digitalWrite(portaled4, HIGH);
    }  
    else  //Caso contrário, apaga o led  
    {  
    digitalWrite(portaled2, LOW);
    digitalWrite(portaled3, LOW);
    digitalWrite(portaled4, LOW);
    }  
}  
}
</code></pre>
 33871: <p>You have a very common problem that is documented all over. You have two libraries, Servo and IRremote, that are both trying to use the same hardware timer. Do a little Google searching for possible fixes. You will need to either find a different Servo library or a different IRremote library.</p>
