I am getting this error.
Arduino: 1.8.2 Hourly Build 2017/02/17 11:33 (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\REMOTE\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.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Here is the entire code:
#include <RFID.h>
#include <Wire.h> // i2C Conection Library
#include <LiquidCrystal_I2C.h> //Memanggil i2C LCD Library
LiquidCrystal_I2C lcd(0x3F, 16, 2);
#include <SPI.h>
#include <RFID.h>
#define SS_PIN 10
#define RST_PIN 9
RFID rfid(SS_PIN,RST_PIN);
const int buzzer = 7; //Passive buzzer ke Pin D7 dan GND
const int doorLock = 8; //Driver Selenoid Door Lock/Relay input ke pin D8
int serNum[5]; //Variable buffer Scan Card
int cards[][5] = { //ID Kartu yang diperbolehkan masuk
{120, 181, 196 ,101, 14}
};
bool access = false;
int alarm = 0;
uint8_t alarmStat = 0;
uint8_t maxError = 5;
void setup(){
Serial.begin(9600);
lcd.begin();
SPI.begin();
rfid.init();
pinMode(doorLock, OUTPUT);
digitalWrite(doorLock, HIGH);
tone (buzzer,1200);
lcd.setCursor (0,0);
lcd.print(F(" RFID System "));
lcd.setCursor (0,1);
lcd.print(F(" Control Access "));
delay (2000);
lcd.clear();
noTone (buzzer);
}
void loop(){
if (alarm >= maxError){
alarmStat = 1; }
if (alarmStat == 0){
lcd.setCursor (0,0);
lcd.print(F(" -System Ready- "));
lcd.setCursor (0,1);
lcd.print(F(" Scan Your Card "));
if(rfid.isCard()){
if(rfid.readCardSerial()){
Serial.print(rfid.serNum[0]);
Serial.print(" ");
Serial.print(rfid.serNum[1]);
Serial.print(" ");
Serial.print(rfid.serNum[2]);
Serial.print(" ");
Serial.print(rfid.serNum[3]);
Serial.print(" ");
Serial.print(rfid.serNum[4]);
Serial.println("");
for(int x = 0; x < sizeof(cards); x++){
for(int i = 0; i < sizeof(rfid.serNum); i++ ){
if(rfid.serNum[i] != cards[x][i]) {
access = false;
break;
} else {
access = true;
}
}
if(access) break;
}
}
if(access){
Serial.println("Welcome!");
lcd.setCursor (0,0);
lcd.print(F(" DOOR UNLOCKED!! :)"));
lcd.setCursor (0,1);
lcd.print("ID:");
lcd.print(rfid.serNum[0]); lcd.print(rfid.serNum[1]);
lcd.print(rfid.serNum[2]); lcd.print(rfid.serNum[3]);
lcd.print(rfid.serNum[4]);
digitalWrite(doorLock, LOW);
tone (buzzer,900);
delay(100);
tone (buzzer,1200);
delay(100);
tone (buzzer,1800);
delay(200);
noTone(buzzer);
delay(600);
lcd.setCursor (0,0);
lcd.print(F("WELCOME"));
lcd.setCursor (0,1);
lcd.print(F("AutoLock after "));
for(int i=5; i>0; i--){
lcd.setCursor (15,1); lcd.print(i);
delay (1000);
}
digitalWrite(doorLock, HIGH);
lcd.clear();
} else {
alarm = alarm+1;
Serial.println("Not allowed!");
lcd.setCursor (0,0);
lcd.print(F(" ACCESS DENIED!! "));
lcd.setCursor (0,1);
lcd.print("ID:");
lcd.print(rfid.serNum[0]); lcd.print(rfid.serNum[1]);
lcd.print(rfid.serNum[2]); lcd.print(rfid.serNum[3]);
lcd.print(rfid.serNum[4]);
tone (buzzer,900);
delay(200);
noTone(buzzer);
delay(200);
tone (buzzer,900);
delay(200);
noTone (buzzer);
delay(500);
lcd.clear();
}
}
rfid.halt();
}
else {
lcd.setCursor (0,0);
lcd.print(F("-System LOCKED- "));
lcd.setCursor (0,1);
lcd.print(F(" Please Wait "));
for(int i=5; i>0; i--){
tone (buzzer,4000);
lcd.setCursor (13,1); lcd.print(i);
lcd.print(F(" "));delay (1000);}
noTone (buzzer);
alarmStat = 0;
alarm = 0;
}
}
//code of an IR REMOTE
#include <IRremote.h>
int RECV_PIN = 2; // the pin where you connect the output pin of TSOP4838
int lock =13 ;
int itsONled[] = {};
/* the initial state of LEDs is OFF (zero)
the first zero must remain zero but you can
change the others to 1's if you want a certain
led to light when the board is powered */
#define code1 26775 // code received from button 1
IRrecv irrecv(RECV_PIN);
decode_results results;
void remote()
{
Serial.begin(9600); // you can comment this line
irrecv.enableIRIn(); // Start the receiver0
pinMode(lock, OUTPUT);
}
void loop_1() {
if (irrecv.decode(&results)) {
unsigned int value = results.value;
switch(value) {
case code1:
if(itsONled[1] == 1) { // if first led is on then
digitalWrite(lock, LOW); // turn it off when button is pressed
itsONled[1] = 0; // and set its state as off
Serial.println("ledl OFF");
} else { // else if first led is off
digitalWrite(lock, HIGH); // turn it on when the button is pressed
Serial.println("led 1 ON");
itsONled[1] = 1; // and set its state as on
}
break;
}
Serial.println(value); // you can comment this line
irrecv.resume(); // Receive the next value
}
}