This is a basic level lazer alarm project. When anyone crosed or kept their hands on the lazer. buzzer starts working but when they took their hand from lazer light buzzer stops. But i want even after taking hands my buzzer should work for few (15-30) seconds .so please help me by giving idea..

  • start a timer ... – jsotola Jun 18 '20 at 8:04
  • 1
    Look at the BlinkWithoutDelay example and learn how to use the millis() function (There are also many tutorials on the web for it). Then start the buzzer, when the lazer barrier triggers, set a timestamp there. When the difference between the current millis() value and the timestamp is over your 15-30s, turn of the buzzer – chrisl Jun 18 '20 at 9:06
  • @chrisl describes a delayed off relative to the start event. You can as well use the stop event (remove hand from "lazer") to start the delayed off time. Try both and understand the difference, when you keep the hand there longer. – DataFiddler Jun 18 '20 at 10:33
  • [turn on buzzer]; delay(15000); [turn off buzzer]; – Gerben Jun 18 '20 at 16:05

If you are using a digital buzzer, you can do:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.