int blueLed = 13; int buzzer = 8; int smokeA0 = A0; // Your threshold value int sensorThres = 400; void setup() { pinMode(blueLed, OUTPUT); pinMode(buzzer, OUTPUT); pinMode(smokeA0, INPUT); Serial.begin(9600); } void loop() { int analogSensor = analogRead(smokeA0); Serial.print("Pin A0: "); Serial.println(analogSensor); // Checks if it has reached the threshold value if (analogSensor > sensorThres) { digitalWrite(blueLed, HIGH); tone(buzzer, 5, 4000); Serial.println("GAS"); } else { digitalWrite(blueLed, LOW); noTone(buzzer); Serial.println("NO GAS"); } delay(100); }