Gas detector and Alerting device with Arduino Uno
![](https://cdn.xingosoftware.com/elektor/images/fetch/dpr_1,w_90/https%3A%2F%2Fwww.elektormagazine.nl%2Fassets%2Fupload%2Fimages%2F42%2F20210303092533_logo-Elektor-JumpStarter-horizontal.png)
![4778](https://cdn.xingosoftware.com/elektor/images/fetch/dpr_1,w_200/https%3A%2F%2Fwww.elektormagazine.com%2Fassets%2Fupload%2Fimg%2Fpublic%2Foriginal%2Fcircuit-20220702191754.jpg)
Gas detector and Alerting device with Arduino Uno
Gas detector and Alerting device with Arduino Uno
Code
Note: This project should not be copied without my permission.//Included Libraries #include "liquidcrystal.h" //MACROS are defined here const int resetPin = 12; const int enablePin = 11; const int d4 = 5; const int d5 = 4; const int d6 = 3; const int d7 = 2; LiquidCrystal lcd16x2(resetPin, enablePin, d4, d5, d6, d7); //Global Variables are declared here float Gas_Sensor; void setup(void) { //put your setup code here, to run once: lcd16x2.begin(16, 2); pinMode(0, INPUT); pinMode(6, OUTPUT); } void loop(void) { //put your main code here, to run repeatedly: here, to run repeatedly: Gas_Sensor = analogRead(0); lcd16x2.setCursor(1 - 1, 1 - 1); lcd16x2.print(Gas_Sensor); if ((Gas_Sensor == 85)) { lcd16x2.setCursor(1 - 1, 2 - 1); lcd16x2.print("No smoke"); } else { if (((Gas_Sensor > 85) && (Gas_Sensor < 115))) { lcd16x2.setCursor(1 - 1, 2 - 1); lcd16x2.print("Little Smoke"); } else { if (((Gas_Sensor > 85) && (Gas_Sensor < 115))) { lcd16x2.setCursor(1 - 1, 2 - 1); lcd16x2.print("Little Smoke"); } else { if (((Gas_Sensor > 116) && (Gas_Sensor < 400))) { lcd16x2.setCursor(1 - 1, 2 - 1); lcd16x2.print("Alert!! Smoke"); digitalWrite(6, true); } else { } } } } delay(0.1 * 1000); }
Discussion (1 comment)