Flame Detector

This project uses the HW-491 Flame Sensor Module. You can either use the Digital or Analog output from the sensor. If you are not familiar, read up on Analog versus Digital Data.

void setup()
{
  pinMode(2, INPUT); //initialize Flame sensor output pin connected pin as input.
  pinMode(LED_BUILTIN, OUTPUT);// initialize digital pin LED_BUILTIN as an output.
  Serial.begin(9600);// initialize serial communication @ 9600 baud:
}

void loop()
{
  if (digitalRead(2) == 0 )
  {
    digitalWrite(LED_BUILTIN, HIGH); // LED ON
    Serial.println(" - - Fire detected! - - ");
  }
  else
  {
    digitalWrite(LED_BUILTIN, LOW); // LED OFF
    Serial.println("No fire detected");
  }
  delay(100);
}

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply