I am doing a project using LPC1769. I intend to use an interrupt for a push button and initially everything is working. However, when I introduce a motor and printf() to my project, my program doesn't work as I expected. I connect L293D to port2 pin 4 and 5 GPIO of LPC to drive my motor and I using port1 pin 31 for my push button.When I run my program, the program like keep printing hello and interrupt to the EINT3 handler more than once when I press the push button. Attached is my C program,could anyone tell me what is going wrong? Is it the switch debouncing problem?Thank you
An easy technique is when the button is pressed, go into a loop and test the button every 1mS, and keep a count. When you get 50 consecutive presses (when the count >=50) you know the button was properly pressed for >50mS.
I also like to make sure the button is released (same process), before allowing it to be tested for pressed condition again.