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
   211   212   213   214   215   216   217   218   219   220   221