#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
int BuzzerPin = 2;
int ledgreen = 3;
int ledred = 4;
int fan = 5;
int sensor = A0;
float gas = 0;

void setup() 
  {
    pinMode(ledgreen, OUTPUT);
    pinMode(ledred, OUTPUT);
    pinMode(fan, OUTPUT);
    pinMode(BuzzerPin, OUTPUT);
    lcd.begin(16, 2);
    lcd.setCursor(2, 0);
    lcd.print("GAS DETECTOR");
    delay(1500);
    lcd.setCursor(0, 1);
    lcd.print("----");
    delay(1000);
    lcd.setCursor(4, 1);
    lcd.print("----");
    delay(1000);
    lcd.setCursor(8, 1);
    lcd.print("----");
    delay(1000);
    lcd.setCursor(12, 1);
    lcd.print("----");
    delay(1000);
    lcd.clear();

  } 
void loop() {

gas = analogRead(sensor);
gas = gas*100/1023;

    lcd.setCursor(0, 0);
    lcd.println("GAS =");     
    lcd.print(gas);
    lcd.print(" %   ");

if (gas > 50) 
  {
    digitalWrite(BuzzerPin, HIGH);
    digitalWrite(ledred, HIGH);
    digitalWrite(ledgreen, LOW);
    digitalWrite(fan, HIGH);
    
    lcd.setCursor(0, 1);
    lcd.print("<< DANGER !!! >>");
    
  }
else
  {
    digitalWrite(BuzzerPin, LOW);
    digitalWrite(ledred,LOW);
    digitalWrite(ledgreen, HIGH);
    digitalWrite(fan, LOW);
    
    lcd.setCursor(0, 1);
    lcd.print("<OUT OF DANGER.>");
    
  }
delay(100);
}
NOCOMNCVCCGNDINLED1PWRRelay Module