How to make Bluetooth FIRE Alert Calling System

 







Click here and download App 

CODE 
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

const int PirSensor = 2;
const int Buzzer = 3;

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3,POSITIVE);

void setup() {
  Serial.begin(9600);
  pinMode(PirSensor, INPUT);
  pinMode(Buzzer, OUTPUT);
  lcd.begin(16, 2);
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("  System Ready");
}

void loop() {
  int motionState = digitalRead(PirSensor);

  if (motionState == LOW) {
    Serial.println("1");

    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(" Fire Detected");
    lcd.setCursor(0, 1);
    lcd.print("I Start Calling");

    unsigned long startTime = millis();
    while (millis() - startTime < 5000) {
      digitalWrite(Buzzer, HIGH);
      delay(500);
      digitalWrite(Buzzer, LOW);
      delay(500);
    }

    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(" System Normal");
  }
}


Post a Comment

Previous Post Next Post

Contact Form