tried both the example that's why it is clearly ,entioned in he heading of the post but tried severl days and night without perfect result. please help me to achieve my goal
capper:
tried both the example that's why it is clearly ,entioned in he heading of the post
How so? You don't mention anything in your original post about trying any of the examples. It would be easier to post your code using the CODE tags. If it's long, then you can remove any irrelevant information that doesn't pertain to the issue you're having.
If you're looking for a hardware debounce, here is an article I found after a simple Google search: