Skip to content

Instantly share code, notes, and snippets.

@arduinothai
Created May 13, 2018 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save arduinothai/e20c4d4c8156bbcd476f905e62808d20 to your computer and use it in GitHub Desktop.
Save arduinothai/e20c4d4c8156bbcd476f905e62808d20 to your computer and use it in GitHub Desktop.
int LED = 13; // Use the onboard Uno LED
int isFlamePin = 2; // This is our input pin
int isFlame = 1; // 1 MEANS NO FLAME
void setup() {
pinMode(LED, OUTPUT);
pinMode(isFlamePin, INPUT);
Serial.begin(9600);
}
void loop() {
isFlame = digitalRead(isFlamePin);
if (isFlame == 0)
{
Serial.println("FLAME, FLAME, FLAME");
digitalWrite(LED, HIGH);
}
else
{
Serial.println("no flame");
digitalWrite(LED, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment