Sensor Gerak Anti Pencuri Berbasis Arduino

Project Untuk Kelompok 7





Komponen yang dibutuhkan :
  • Arduino (Versi apapun) >> 1 Buah.
  • Sensor PIR (passive infrared) HC-SR501 >> 1 Buah.
  • Buzzer >> 1 Buah.
  • Led >> 1 Buah.
  • Resistor 1K >> 1 Buah.
  • Kabel >> Seperlunya.

Wiring :

Source Code :
     /*  
      * Generated Code by Kang Kamal  
      * kangkamal.blogspot.com  
      */  
     int pinLed = 13;  
     int buzzer = 8;  
     int pinPIR = 7;  
     int terdeteksi;  
     void setup() {  
      // put your setup code here, to run once:  
      Serial.begin(9600);  
      pinMode(pinLed, OUTPUT);  
      pinMode(buzzer, OUTPUT);  
      pinMode(pinPIR, INPUT);  
      digitalWrite(pinLed, LOW); //Matikan Led  
      digitalWrite(buzzer, LOW); //Matikan Buzzer  
     }  
     void loop() {  
      // put your main code here, to run repeatedly:  
      terdeteksi = digitalRead(pinPIR);  
      if (terdeteksi == HIGH){ //Jika terdeteksi objek bergerak  
       digitalWrite(pinLed, HIGH); //Nyalakan Led  
       digitalWrite(buzzer, HIGH); //Nyalakan Buzzer  
       delay(2000);  
       digitalWrite(pinLed, LOW); //Matikan Led  
       digitalWrite(buzzer, LOW); //Matikan Buzzer  
      }  
      else{  
       digitalWrite(pinLed, LOW); //Matikan Led  
       digitalWrite(buzzer, LOW); //Matikan Buzzer  
      }  
     }  
    

    comment 0 comments:

    Post a Comment

    CNC Tutorial Cetak si SAM Assistant

     
    © All 4 You... | Design by Blog template in collaboration with Concert Tickets, and Menopause symptoms
    Powered by Blogger