int pingas = 8;
int pinbuz = 9;
int ciumGas;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.print("sensor gas menyala");
}
void loop() {
// put your main code here, to run repeatedly:
ciumGas = digitalWrite(pingas);
if (ciumGas) {
Serial.println(" aman ");
delay(100);
noTone(pinbuz);
} else {
Serial.println(" bahaya ");
tone(pinbuz, 582);
delay(500);
}
delay(2000);
}