if pin 1 is high in 3seconds led will turn on else ignore .(if statement .help.)

UKHeliBob:
Does that code do what you want ?

What happens if the user presses the button for 2.5 seconds then releases it ?
What will the value of x be then ?

What value will x have after the user now presses the button for 1 second ?

ow. wow, thank you very much. i didnt recognize it. i tried it, it looks solved but i realized that you are correct.
i think i need to add x = 0 at the else statement. thank you for the post.