# 10.2 Flame

## Hardware Wiring

![Flame](https://2341898987-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LCFDbcteyTR3tQSs-5x%2F-LCFE4dCRQBMq1ajywfh%2F-LCFELLI9WW1nXpLD4pW%2F023_flame.jpg?generation=1526059592400916\&alt=media)

## Sketch

The code can be found at [Examples\_Arduino - sensor-kit-for-arduino - \_023\_Flame - \_023\_Flame.ino](https://github.com/LongerVisionRobot/Examples_Arduino/blob/master/sensor-kit-for-arduino/_023_Flame/_023_Flame.ino).

```
int Led=13;       // Define LDE Pin
int buttonpin=3;  // Define Flame Sensor Pin
int val;          // Define Variable val
void setup()
{
  pinMode(Led,OUTPUT); // Define LED as output
  pinMode(buttonpin,INPUT); // Define flame detector as input
}
void loop()
{
  val=digitalRead(buttonpin);// Assign digitl pin's reading to val
  if(val==HIGH)   // If flame detected, LED starts flashing
  {
    digitalWrite(Led,HIGH);
  }
  else
  {
    digitalWrite(Led,LOW);
  }
}
```
