void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(34, OUTPUT); pinMode(32, OUTPUT); } void loop() { delay(10); int gas_reading= analogRead(34); Serial.print("Gas Leakage = "); Serial.print(gas_reading); if(gas_reading>2000){ tone(32, 2000); } else{ noTone(32); } }