int BEL = 13;
int PIR = 15;
int PIRstatus = 0;
//int LCD =
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 25, 26, 27, 33, 32);
void setup() {
// put your setup code here, to run once:
Serial1.begin(115200);
Serial1.println("Sensor Gerak Dengan Output Suara");
pinMode(PIR, INPUT);
pinMode(BEL, OUTPUT);
lcd.begin(16, 2);
lcd.print("Assalamualikum");
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
PIRstatus = digitalRead(PIR);
if(PIRstatus == HIGH){
digitalWrite(BEL, HIGH);
tone(BEL,1000);
lcd.print("Ada Gerakan !");
Serial1.println("Ada gerakan !");
}else{
digitalWrite(BEL, LOW);
tone(BEL,0);
lcd.print("Tidak Ada Gerakan");
Serial1.println("Tidak ada gerakan");
}
delay(500);
}