Flame Sensor with Alarm
Wiring for the Flame Sensor
Arduino
Flame Sensor
GD
G
A0
A0
5V
+
Wiring for the Buzzer
Arduino
Buzzer
13
+
GND
-
Code:
int sensorPin = A0; // select the input pin for the potentiometer
int buzzer = 13; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor
void setup()
{
pinMode(buzzer, OUTPUT);
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
if (sensorValue < 40) {
tone(buzzer, 1000);
}
else {
noTone(buzzer);
}
}
Last updated
Was this helpful?