Page 216 - Tasarım Beceri Atölyeleri Öğretmen El Kitabı
P. 216
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“Alarm Activated!”);
initialDistance = getDistance();
activateAlarm = false;
alarmActivated = true;
}
if (alarmActivated == true){
currentDistance = getDistance() + 10;
if ( currentDistance < initialDistance) {
tone(buzzer, 1000); // Send 1KHz sound signal
lcd.clear();
enterPassword();
}
}
if (!alarmActivated) {
if (screenOffMsg == 0 ){
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“A - Activate”);
lcd.setCursor(0,1);
lcd.print(“B - Change Pass”);
screenOffMsg = 1;
}
keypressed = myKeypad.getKey();
if (keypressed ==’A’){ //If A is pressed, activate the alarm
tone(buzzer, 1000, 200);
208