I am doing a project for measuring the water amount in a tub, whenever the water amount gets too low the buzzer will turn on and change tones to warn the user about the low water level, if the user wants to turn off the buzzer, he will use the remote control, there is also a LCD that displays the water value if it is "CRITICAL", "OK", or "excellent".
#include <IRremote.h>
#include <LiquidCrystal.h>
int waterP = A4;
int waterV = 0; // water sensor pin and value
int readT = 500;
int rs=9;
int en=7;
int d4=11;
int d5=10; //LCD vars
int d6=8;
int d7=12;
int irP = 2;
int buzP = 3;
int buzzsL = 255; //buzz vars
int buzzsS = 230;
LiquidCrystal lcd(rs,en,d4,d5,d6,d7);
void setup() {
// put your setup code here, to run once:
pinMode(waterP,INPUT); //water sensor config
Serial.begin(9600); //Serial config
lcd.begin(16,2); //LCD config
pinMode(buzP,OUTPUT); // buzzer config
IRrecv IR(irP);
decode_results cmd; //IR pins & vars
String cmnd;
IR.enableIRIn(); // IR start
}
void loop() {
// put your main code here, to run repeatedly:
waterV = analogRead(waterP);
Serial.print(waterV); // water sensor value reading + print value
Serial.print("\n");
lcd.setCursor(0,0);
lcd.print("water level:");
if(waterV < 100){
tone(buzP,450); // Turn on buzzer
delay(200);
noTone(buzP); // Turn of buzzer
delay(300);
lcd.clear(); // if water sensor reads less than 100, buzzer tunrs on
lcd.setCursor(0,0);
lcd.print("water level:");
lcd.setCursor(0,2);
lcd.print("CRITICAL!");
waterV = analogRead(waterP);
delay(readT);
}
if(waterV > 200){
digitalWrite(buzP,0);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("water level:");
lcd.setCursor(0,2);
lcd.print("excellent!");
waterV = analogRead(waterP);
delay(readT);
}
}
But for some reason whenever I upload the code I get this error message
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port':
(.text+0x0): multiple definition of `__vector_7'
C:"my file place" (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1