home alarm system problem in code

I have tried these .I will try to describe exactly my problem

  1. When the alarm is activated and the window open.
    start the alarm siren
    if I press the correct code stop the alarm siren and turn off the system (this is ok )

  2. When the alarm is activated and door open.
    Wait 10 sec and if i dont press the correct code in 10 sec, start the alarm siren.
    If I press the correct code in 10 sec . Stop the alarm siren and turn off the system.
    After the 10 sec if I press the correct code stop the alarm siren

The second piece is the my problem i nead a delay of 10 sec