@iOT_India

CODE :
#define FIRE_SENSOR_PIN 3
#define BUZZER_PIN 4
#define LED_PIN 2

void setup() {
  pinMode(FIRE_SENSOR_PIN, INPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  pinMode(LED_PIN, OUTPUT);
}

void loop() {
  int fireDetected = digitalRead(FIRE_SENSOR_PIN);
  
  if (fireDetected == LOW) {
    // Fire is detected
    digitalWrite(BUZZER_PIN, HIGH); // Turn on the buzzer
    digitalWrite(LED_PIN, HIGH); // Turn on the LED
    delay(1000); // Beep for 1 second
    digitalWrite(BUZZER_PIN, LOW); // Turn off the buzzer
    digitalWrite(LED_PIN, LOW); // Turn off the LED
    delay(1000); // Wait for 1 second before checking again
  }
}

@YamyaV

Great 👍

@iOT_India

CONNECTIONS :

Fire Sensor:

D0 -> Pro Micro Pin 2

VCC -> 5V or 3.3V

GND -> GND

Buzzer:

Positive (+) -> Pro Micro Pin 3

Negative (-) -> GND

LED:

Anode (longer leg) -> Current Limiting Resistor -> Pro Micro Pin 4

Cathode (shorter leg) -> GND

Pro Micro:

GND -> Ground (GND) of power source

VCC -> Positive terminal of power source (5V)