Page 209 - Tasarım Beceri Atölyeleri Öğretmen El Kitabı
P. 209

EK-4

               if (alarmActivated == true){
                     currentDistance = getDistance() + 10;
                     if ( currentDistance < initialDistance) {

                       tone(buzzer, 1000); // 1KHz ses sinyali yollama
                       lcd.clear();
                       enterPassword();
                     }
                   }


                                                              EK-5

               void enterPassword() {

                 int k=5;
                 tempPassword = “”;
                 activated = true;
                 lcd.clear();
                 lcd.setCursor(0,0);
                 lcd.print(“ *** ALARM *** “);
                 lcd.setCursor(0,1);
                 lcd.print(“Pass>”);
                     while(activated) {
                     keypressed = myKeypad.getKey();
                     if (keypressed != NO_KEY){

                       if (keypressed == ‘0’ || keypressed == ‘1’ || keypressed == ‘2’ || keypressed == ‘3’ ||
                           keypressed == ‘4’ || keypressed == ‘5’ || keypressed == ‘6’ || keypressed == ‘7’ ||
                           keypressed == ‘8’ || keypressed == ‘9’ ) {
                         tempPassword += keypressed;
                         lcd.setCursor(k,1);
                         lcd.print(“*”);
                         k++;



                                                                                                                     201
   204   205   206   207   208   209   210   211   212   213   214