Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(safetyDistance <= 5) { //If distance 5cm or less
- boolean alarmSetOff = true;
- digitalWrite(ledGREEN, LOW); //Turn green LED off
- digitalWrite(ledRED, HIGH); //Turn red LED on
- digitalWrite(buzzer, HIGH); //Turn buzzer on
- TFTscreen.background(0, 0, 0); //Clear the screen with a black background
- displayLockScreen(); //Display "use fingerprint to unlock" message
- //Fingerprint sensor
- fps.Open(); //send serial command to initialise FPS
- fps.SetLED(true); //turn on LED so finger can be read
- delay(20);
- fps.SetLED(false);
- delay(20);
- fps.SetLED(true);
- delay(20);
- fps.SetLED(false);
- delay(20);
- fps.SetLED(true);
- digitalWrite(ECHO_PIN, LOW);
- }
- else if(safetyDistance <= 5 && alarmSetOff, true) { //If distance 5cm or less but alarm already set off, LED stays red
- digitalWrite(ledGREEN, LOW); //Turn green LED off
- digitalWrite(ledRED, HIGH); //Turn red LED on
- }
- else{ //If distance > 5cm
- digitalWrite(ledGREEN, HIGH); //Turn green LED off
- digitalWrite(ledRED, LOW); //Turn red LED on
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement