Pooja Baraskar
Published © GPL3+

Burglar Alarm with PIR Motion Sensor

This article explains Burglar Alarms with a PIR Motion Sensor.

BeginnerFull instructions provided2,753
Burglar Alarm with PIR Motion Sensor

Things used in this project

Story

Read more

Schematics

WP_20150831_020.jpg

Code

Code

C/C++
    void loop()   
    {  
        if(isPeopleDetected())   //if it detects the moving people  
            turnOnBuzzer();  
        else  
            turnOffBuzzer();  
    }  
    void turnOnBuzzer()  
    {  
           digitalWrite(LED,HIGH);  
        for (int i = 0; i < length; i++)   
        {  
            if (notes[i] == ' ')  
            {  
                delay(beats[i] * tempo); // rest  
            }  
            else  
            {  
                playNote(notes[i], beats[i] * tempo);  
            }  
      
            // pause between notes  
            delay(tempo / 2);  
        }  
    }  
    void turnOffBuzzer()  
    {  
      digitalWrite(LED,LOW);      
      digitalWrite(speakerPin,LOW);  
    }  

Credits

Pooja Baraskar

Pooja Baraskar

25 projects • 155 followers
Intel Software Innovator and developer at Geek Monkey Studios. She is a Microsoft Certified Professional and C# specialist.

Comments