Skip to content

Instantly share code, notes, and snippets.

/Smoke Sensor Secret

Created April 29, 2017 12:09
Show Gist options
  • Save anonymous/42b3a9360f89bf8a5e8dc77cbe374f1a to your computer and use it in GitHub Desktop.
Save anonymous/42b3a9360f89bf8a5e8dc77cbe374f1a to your computer and use it in GitHub Desktop.
Code to run smoke sensor
int smokeA0 = A5;
// Your threshold value
int sensorThres = 100;
void setup() {
pinMode(smokeA0, INPUT);
pinMode(8, OUTPUT);
Serial.begin(9600);
}
void loop() {
Serial.print("");
int analogSensor = analogRead(smokeA0);
// Checks if it has reached the threshold value
if (analogSensor > sensorThres)
{
Serial.print("");
Serial.print("there is fire");
Serial.print("");
delay(1000);
Serial.print(" ");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment