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

else if (tempPassword != password) {
                         lcd.setCursor(0,1);
                         lcd.print(“Wrong! Try Again”);
                         delay(2000);
                         lcd.clear();
                         lcd.setCursor(0,0);

                         lcd.print(“ *** ALARM *** “);
                         lcd.setCursor(0,1);
                         lcd.print(“Pass>”);
                       }
                     }
                   }
               }
               // Custom function for the Ultrasonic sensor
               long getDistance(){

                 //int i=10;

                 //while( i<=10 ) {
                 // Clears the trigPin
                 digitalWrite(trigPin, LOW);
                 delayMicroseconds(2);


                 // Sets the trigPin on HIGH state for 10 micro seconds
                 digitalWrite(trigPin, HIGH);
                 delayMicroseconds(10);
                 digitalWrite(trigPin, LOW);



                 // Reads the echoPin, returns the sound wave travel time in microseconds
                 duration = pulseIn(echoPin, HIGH);







                                                                                                                     213
   216   217   218   219   220   221   222   223   224   225   226