Skip to content

Instantly share code, notes, and snippets.

@elktros
Created July 7, 2018 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elktros/1fdd05f6208db2b8760c08f28dd59138 to your computer and use it in GitHub Desktop.
Save elktros/1fdd05f6208db2b8760c08f28dd59138 to your computer and use it in GitHub Desktop.
Code for interfacing a Flame Sensor with Arduino.
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