GAS LEAKGE DETECTION SENSOR || MQ-135 GAS SENSOR || ANY GAS LEAKAGE DETE...






CIRCUIT:-




CODE:-


int BUZZER = 11;
int GAS_SENSOR = A0;
int SENSORTHRESHOLD = 200;
void setup() {
  Serial.begin(9600);
pinMode(BUZZER, OUTPUT);
pinMode(GAS_SENSOR, INPUT);
}

void loop() {
  int SENSOR = analogRead(GAS_SENSOR);
  
  if(SENSOR-50 > SENSORTHRESHOLD){
tone(BUZZER, 1000); // Send 1KHz sound signal...
  delay(500);        // ...for 1 sec
  noTone(BUZZER);     // Stop sound...
  delay(500);        // ...for 1sec
    }
   Serial.println(SENSOR-50);
   }

Post a Comment

0 Comments