Skip to main content
added 485 characters in body
Source Link
sedflix
  • 109
  • 1
  • 4

The error showshown is

C:\Users\SIDDHA~1\AppData\Local\Temp\build3397782103973366883.tmp/core.a(Tone.cpp.o): In function `__vector_7':
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Tone.cpp:536: multiple definition of `__vector_7'
C:\Users\SIDDHA~1\AppData\Local\Temp\build3397782103973366883.tmp\IRremote\IRremote.cpp.o:C:\Users\Siddharth Yadav\Documents\Arduino\libraries\IRremote/IRremote.cpp:361: first defined here
collect2.exe: error: ld returned 1 exit status

The error show is

The error shown is

C:\Users\SIDDHA~1\AppData\Local\Temp\build3397782103973366883.tmp/core.a(Tone.cpp.o): In function `__vector_7':
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Tone.cpp:536: multiple definition of `__vector_7'
C:\Users\SIDDHA~1\AppData\Local\Temp\build3397782103973366883.tmp\IRremote\IRremote.cpp.o:C:\Users\Siddharth Yadav\Documents\Arduino\libraries\IRremote/IRremote.cpp:361: first defined here
collect2.exe: error: ld returned 1 exit status
Source Link
sedflix
  • 109
  • 1
  • 4

Error in Compiling

The error show is

Error snapshot

Why is this happening?

The code is:

#include <IRremote.h>

const int echo = 7;// connected to ultrasonic sensor's echo
const int trig = 8;// connected to ultrasonic sensor's trig
const int Right1 = 10;
const int Right2 = 11;
const int Left1 = 12;
const int Left2 = 9;// change this to any other pin; except pin 13
const int buzzer = 5;
const int rightIR = 3;// change here
const int leftIR = 2;// change here
int RECV_PIN = 4;
const int forward = 51;
const int backward = 36;
const int left = 19;
const int right = 0;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup() {
  pinMode(buzzer, OUTPUT);
  pinMode(echo, INPUT_PULLUP);
  pinMode(rightIR, INPUT_PULLUP);
  pinMode(leftIR, INPUT_PULLUP);
  pinMode(trig, OUTPUT);
  pinMode(Right1, OUTPUT);
  pinMode(Right2, OUTPUT);
  pinMode(Left1, OUTPUT);
  pinMode(Left2, OUTPUT);
  sing(1);
  Serial.begin(9600);
 irrecv.enableIRIn(); // Start the receiver

}

void loop() {
  digitalWrite(13, HIGH);
  if (calcDistance() > 30 && !isRight() && !isLeft())
  {
    if (irrecv.decode(&results))
    {
      Serial.println(results.value, HEX);
      irrecv.resume(); // Receive the next value
      delay(50);
    }
    else {
      moveForward();
    }

  }
  else
  {
    delay(10);
    int dist = calcDistance();
    if (dist < 30 && isLeft() && isRight())
    {
      Serial.println("Moving backward");
      tone(buzzer, 4699, 10);
      moveBackward();
      delay(1000);
    }
    else if (isLeft())
    {
      turnRight();
      digitalWrite(13, LOW);
      tone(buzzer, 104, 10);
      Serial.println("Turning Right");
    }
    else if (isRight())
    {
      turnLeft();
      digitalWrite(13, LOW);
      delay(300);
      tone(buzzer, 880, 10);
      Serial.println("Turning LEft");
    }
    else if (dist < 30)
    {
      turnRight();
      digitalWrite(13, LOW);
      tone(buzzer,  104 , 10);
      Serial.println("Turning Right");
    }

  }

  delay(20);
}