Sensor project arduino. If there is an accidental fire near the sensor, the sensor will detect and turn off the current and power supply of the house automatically.

sensor project Arduino.
If there is an accidental fire near the sensor, the sensor will detect and turn off the current and power supply of the house automatically.


Here I show with my hands the LED lights off. I could have turned it off with fire if I wanted to but a lot of kids are inspired to watch this video of mine.so I have made this project video with my hand.


Source code:

int led = 13;

int pin = 2;

int value = 0;

int pirState = LOW;


void setup() {

  pinMode(led, OUTPUT);

  pinMode(pin, INPUT);

  Serial.begin(9600);

}


void loop() {


  value = digitalRead(pin);


  if (value == HIGH) {

    digitalWrite(led, HIGH);


    if (pirState == LOW) {

      Serial.println("Motion Detected!");

      pirState = HIGH;

    }

  }else{

    digitalWrite(led, LOW);


    if(pirState == HIGH){

      Serial.println("Motion Ended!");

      pirState = LOW;

      }

    }

}


Comments