Automatic gas leakage exhaust fan on


 Arduino code:

/*


code started


   #define Sensor pin = A0;

   #define relay pin = D9;

   #define Buzzer Pin = D8;


       code created by Innovative ideas 

        For any help  DM on

 https://www.instagram.com/innovative_ideas_yt/?hl=en

    */ 


 #define sensorDigital A0


#define relay 9


#define buzzer 8


#define sensorAnalog A1


void setup() {


  pinMode(sensorDigital, INPUT);


    pinMode(relay, OUTPUT);


      pinMode(buzzer, OUTPUT);


        Serial.begin(9600);


        }


        void loop() {


          bool digital = digitalRead(sensorDigital);


            int analog = analogRead(sensorAnalog);


  Serial.print("Analog value : ");


    Serial.print(analog);


      Serial.print("t");


        Serial.print("Digital value :");


          Serial.println(digital);


  if (digital == 0) {


      digitalWrite(relay, LOW);

        

       digitalWrite(buzzer, HIGH);

        delay(5000);

        digitalWrite(relay, HIGH);

        digitalWrite(buzzer, LOW);


            } else {


                digitalWrite(relay, HIGH);


                    digitalWrite(buzzer, LOW);


       }


            }

Post a Comment

8 Comments

  1. Replies
    1. Sir is project ka coding error dy raha ha kisi k pass correct coding ha to plz send kar dan

      Delete
    2. Bro kaise bnae model phir,
      Plz help!

      Delete
  2. Adriano nano use kar rahi hu par code error aa raha hai please send the correct code

    ReplyDelete
  3. Code galat nahi A0 ko A1 kardo code run ho jaye ga...
    #define Sensor pin = A1;

    #define relay pin = D9;

    #define Buzzer Pin = D8;






    #define sensorDigital A1



    #define relay 9



    #define buzzer 8



    #define sensorAnalog A1



    void setup() {



    pinMode(sensorDigital, INPUT);



    pinMode(relay, OUTPUT);



    pinMode(buzzer, OUTPUT);



    Serial.begin(9600);



    }



    void loop() {



    bool digital = digitalRead(sensorDigital);



    int analog = analogRead(sensorAnalog);



    Serial.print("Analog value : ");



    Serial.print(analog);



    Serial.print("t");



    Serial.print("Digital value :");



    Serial.println(digital);



    if (digital == 0) {



    digitalWrite(relay, LOW);



    digitalWrite(buzzer, HIGH);

    delay(5000);

    digitalWrite(relay, HIGH);

    digitalWrite(buzzer, LOW);



    } else {



    digitalWrite(relay, HIGH);



    digitalWrite(buzzer, LOW);



    }



    }

    ReplyDelete