int buzz1=3;
int buzz2=4;
int pir=2;
#define gas A0
void setup() {
pinMode(buzz1, OUTPUT);
pinMode(buzz2, OUTPUT);
pinMode(pir, INPUT);
pinMode(gas, INPUT);
Serial.begin(9600);
}
void loop() {
int movimiento=digitalRead(pir);
int cgas=analogRead(gas);
Serial.print("Movimiento... ");
Serial.println(movimiento);
delay(500);
Serial.print("Cantidad de gas es de ");
Serial.println(cgas);
delay(500);
if (movimiento==0 && cgas>700){
tone(buzz1,600);
delay(100);
tone(buzz1,0);
delay(100);
tone(buzz2, 800);
delay(100);
tone(buzz2, 0);
delay(100);
}
else{
noTone(buzz1);
noTone(buzz2);
}
}