George Kartsonas
Published © GPL3+

Autonomous Fire Hazard System

The time has come to automate our good old fire alarms and make them part of an interconnected world.

BeginnerFull instructions provided1 hour968
Autonomous Fire Hazard System

Things used in this project

Story

Read more

Code

Autonomous Fire Hazard System Code

Arduino
int LED = 7; // Use the onboard LED
int LIGHTS = 6;
int isFlamePin = 0;  // This is our input pin
int isFlame = LOW;  // LOW MEANS NO FLAME

void setup() {
  pinMode(LED, OUTPUT);
  pinMode(LIGHTS, OUTPUT);
  pinMode(isFlamePin, INPUT);
}

void loop() {
  isFlame = digitalRead(isFlamePin);
  if (isFlame== LOW)
  {
     digitalWrite(LED, LOW);
     digitalWrite(LIGHTS, LOW);
  }
  else
  {
      digitalWrite(LED, HIGH);
      digitalWrite(LIGHTS, HIGH);
      Particle.publish("Fire", "House is on fire", PUBLIC);
  }
}

Credits

George Kartsonas
19 projects • 46 followers
Contact

Comments

Please log in or sign up to comment.