# Flame Sensor with Alarm

![Flame Sensor Wired Up](https://lh5.googleusercontent.com/qQ_MD8c7bU7ZlGIwRU512e7A9bPokkVPhZqT93aqmaDy7jD3rRUf3KQUyN145lZxOQNXQXJh_RbVVi706ZcoQv4kHAkRS7nTNUZWQcDT0DZCdZo-pvAEbTLaGqWCyPuCi5NbKpYhk5UhzzPbaA)

#### Wiring for the Flame Sensor

| Arduino | Flame Sensor |
| ------- | ------------ |
| GD      | G            |
| A0      | A0           |
| 5V      | +            |

#### Wiring for the Buzzer

| Arduino | Buzzer |
| ------- | ------ |
| 13      | +      |
| GND     | -      |

#### Code:

```cpp
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);
  }
}


```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guides.mccaskeyrobotics.org/arduino/flame-sensor-with-alarm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
