Fire alarm using Arduino
Connect Buzzer+ to Arduino D11
Connect Buzzer- to Arduino GND
Connect Sensor+ to Arduino 5v
Connect Sensor- to Arduino GND
Connect Sensor OUT to Arduino D8
CODE:
// This code is witten by Mridul Hasan content creator @ (Hobby Tech BD) YouTube Channel
// Powerd by Radiogear BD an Electronis, Robotics @ RC Store
// website: www.radiogearbd.com
int buzzer = 11;
int sensor = 8;
void setup() {
pinMode (buzzer, OUTPUT);
pinMode (sensor, INPUT);
digitalWrite (buzzer, HIGH);
delay (1000);
}
void loop() {
int sen = digitalRead(sensor);
if (sen == LOW)
{
digitalWrite(buzzer, HIGH);
delay (2000);
}
else
{
digitalWrite(buzzer, LOW);
}
}