int LEDtian = 9;
int PIRsensor = 4;
int buzzyow = 7;
boolean start = false;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(LEDtian, OUTPUT);
pinMode(PIRsensor,INPUT);
pinMode(buzzyow, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(PIRsensor)==HIGH){
digitalWrite(LEDtian, HIGH);
for(int sound = 1100; sound >=31; sound -= 100){
tone(buzzyow,sound);
}
Serial.println("MOTION DETECTED");
}
else{
digitalWrite(LEDtian, LOW);
noTone(buzzyow);
Serial.println("MOTION NOT DETECTED");
}
}