help me with my final year project. i cant compile my project because im stuck with with this problem in line 90. im a beginner so please i would like you to help me
this is the code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>LiquidCrystal_I2C lcd(0x27, 20, 4); // pins for LCD Connection
#define buzzer 12 // buzzer pin
#define led 13 //led pin#define x A0 // x_out pin of Accelerometer
#define y A1 // y_out pin of Accelerometer
#define z A2 // z_out pin of Accelerometer/variables/
int piezoPin = 7;
int LED1 = 13;
int LED2 = 12;
int LED3 = 11;
int xsample = 0;
int ysample = 0;
int zsample = 0;
long start;
int buz = 0;/Macros/
#define samples 50
#define fiveMax 20 // max change limit
#define fiveMin -20 // min change limit
#define threeMax 10
#define threeMin -10
#define twoMax 5
#define twoMin -5
#define buzTime 5000 // buzzer on timevoid setup()
{
lcd.init();
lcd.init();
Serial.begin(9600); // initializing serial
delay(1000);
lcd.backlight();
lcd.setCursor(3, 0);
lcd.print("Home-based");
lcd.setCursor(1, 1);
lcd.print("Quake Detector");
delay(2000);
lcd.clear();
lcd.print("Calibrating.....");
lcd.setCursor(0, 1);
lcd.print("Please wait...");
pinMode(buzzer, OUTPUT);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
buz = 0;
digitalWrite(buzzer, buz);
digitalWrite(led, buz);
for (int i = 0; i < samples; i++) // taking samples for calibration
{
xsample += analogRead(0);
ysample += analogRead(1);
zsample += analogRead(2);
}xsample /= samples; // taking avg for x
ysample /= samples; // taking avg for y
zsample /= samples; // taking avg for zdelay(3000);
lcd.clear();
lcd.print("Calibrated");
delay(1000);
lcd.clear();
lcd.print("Device Ready");
delay(3000);
lcd.clear();
lcd.noBacklight();
}void loop()
{
int value1 = analogRead(0); // reading x out
int value2 = analogRead(1); //reading y out
int value3 = analogRead(2); //reading z outint xValue = xsample - value1; // finding change in x
int yValue = ysample - value2; // finding change in y
int zValue = zsample - value3; // finding change in z
}{ /* comparing change with predefined limits*/
{
if (xValue < twoMin || xValue > twoMax || yValue < twoMin || yValue > twoMax || zValue < twoMin || zValue > twoMax)
{
digitalWrite(LED1, HIGH);
}
else if (xValue > twoMin || xValue < twoMax || yValue > twoMin || yValue < twoMax || zValue > twoMin || zValue < twoMax)
{
digitalWrite(LED1, LOW);
}
}
{
if (xValue < threeMin || xValue > threeMax || yValue < threeMin || yValue > threeMax || zValue < threeMin || zValue > threeMax)
{
{
if (buz == 0)
start = millis(); // timer start
buz = 1; // buzzer / led flag activated
}else if (buz == 1) // buzzer flag activated then alerting earthquake
{
tone(piezoPin, 1000, 500);
digitalWrite(LED2, HIGH);
delay(1000);
digitalWrite(LED2, LOW);
delay(1000);
if (millis() >= start + buzTime)
buz = 0;
}
}
else if (xValue > threeMin || xValue < threeMax || yValue > threeMin || yValue < threeMax || zValue > threeMin || zValue < threeMax)
{
digitalWrite(LED2, LOW);
}
}
{
if (xValue < fiveMin || xValue > fiveMax || yValue < fiveMin || yValue > fiveMax || zValue < fiveMin || zValue > fiveMax)
{
if (buz == 0)
start = millis(); // timer start
buz = 1; // buzzer / led flag activated
}else if (buz == 1) // buzzer flag activated then alerting earthquake
{
lcd.backlight();
lcd.setCursor(3, 0);
lcd.print("Evacuate!!");
lcd.setCursor(0, 1);
lcd.print("Drop Cover Hold");
tone(piezoPin, 100, 50);
digitalWrite(led, HIGH);
delay(50);
digitalWrite(led, LOW);
delay(50);
if (millis() >= start + buzTime)
buz = 0;
}
}
}digitalWrite(buzzer, buz); // buzzer on and off command
digitalWrite(led, buz); // led on and off command/sending values to processing for plot over the graph/
Serial.print("x=");
Serial.println(xValue);
Serial.print("y=");
Serial.println(yValue);
Serial.print("z=");
Serial.println(zValue);
Serial.println(" $");
}