#include <Liquidcrystal_I2C.>
int pir = 7;
int statusPir = 0;
int buzzerpin = 9;
liquidCrystal_I2C lcd (0x27, 16, 2)
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.print("sistem pendeteksi Gempa");
lcd.begin(16, 2);
pinMode(pir, INPUT);
pinMode(buzzerpin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
statuspir = digitalRead(pi);
if(statuspir == HIGH){
tone(buzzerpin, 31);
lcd.setCursor(0,0)
lcd.println("Terdeteksi Gempa Bumi");
Serial.println("Terdeteksi Gempa Bumi");
}else{
noTone(buzzerpin);
lcd.setcursor(0,0);
Serial.println("Tidak Terdeteksi Gempa Bumi");
}
delay(1000);
}