Devices & Components
Arduino Uno Rev3
wire
Breadboard (generic)
KY-026 Flame sensor
LED (generic)
Software & Tools
Arduino IDE
Project description
Code
KY-026 Flame sensor
c_cpp
A program to power a led while the flame is activated
1#define led 3 // define the LED pin 2#define digitalPin 2 // KY-026 digital interface 3int digitalVal; // digital readings 4void setup() 5{ 6 pinMode(led, OUTPUT); 7 pinMode(digitalPin, INPUT); 8 pinMode(digitalPin, INPUT_PULLUP); 9} 10void loop() 11{ 12 // Read the digital pin 13 digitalVal = digitalRead(digitalPin); 14 if (digitalVal == HIGH) // if flame is detected then 15 { 16 digitalWrite(led, HIGH); // turn ON Arduino's LED 17 } 18 else 19 { 20 digitalWrite(led, LOW); // turn OFF Arduino's LED 21 } 22}
Downloadable files
Flame sensor diagram
A diagram to know how to connect flame to arduino
Flame sensor diagram

Flame sensor diagram
A diagram to know how to connect flame to arduino
Flame sensor diagram

Comments
Only logged in users can leave comments