-
-
Save anonymous/42b3a9360f89bf8a5e8dc77cbe374f1a to your computer and use it in GitHub Desktop.
Code to run smoke sensor
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
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