Description
The Flame Sensor Module For Arduino KY-026 is a simple circuit that uses a flame module and a digital 13 interface with an LED. The LED is connected to the digital 13 interface and the flame sensor is connected to the digital 3 interface. When the flame sensor detects a signal, the LED will light up and vice versa. The code provided by Li Chengyuan defines the LED and flame sensor interfaces and sets up the circuit. In the loop, the code reads the value from the flame sensor and if it is high, the LED will flash. Otherwise, the LED will remain off.
Flame module and digital 13 interface with LED to build a simple circuit, making flame tips
The digital 13 interface comes with the LED, the flame sensor access digital 3 interface, when the flame sensor sensed a key signal, LED light, and vice versa.
Li Chengyuan Code:
Int Led=13; / / LED interface definition
Int buttonpin=3; / / flame sensor interface definition
Int Val; / / define digital variable val
Setup void ()
{
PinMode (Led, OUTPUT); / / LED was defined as the output interface
PinMode (buttonpin, INPUT); / / define the flame sensor output interface
}
Loop void ()
{
Val=digitalRead (buttonpin); / / digital interface 3 the value read is assigned to val
If (val==HIGH) / / when the flame sensor signal, LED flashing
{
DigitalWrite (Led, HIGH);
}
Else
{
DigitalWrite (Led, LOW);
}
}