Created
July 7, 2018 09:18
-
-
Save elktros/1fdd05f6208db2b8760c08f28dd59138 to your computer and use it in GitHub Desktop.
Code for interfacing a Flame Sensor with Arduino.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int buzzerPin = 12; | |
const int flamePin = 11; | |
int Flame = HIGH; | |
void setup() | |
{ | |
pinMode(buzzerPin, OUTPUT); | |
pinMode(flamePin, INPUT); | |
Serial.begin(9600); | |
} | |
void loop() | |
{ | |
Flame = digitalRead(flamePin); | |
if (Flame== LOW) | |
{ | |
Serial.println("Fire!!!"); | |
digitalWrite(buzzerPin, HIGH); | |
} | |
else | |
{ | |
Serial.println("No worries"); | |
digitalWrite(buzzerPin, LOW); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment