I plug the interrupts pin 5 (pin 18 in my board) to a circuit this a pull up resistor and a push button
=> Value of the digital must be 1 when button is unpressed and must be 0 when button is pressed.
For some interrupts pin (0, 1 and 3) all works fine (my code is updated according to the selected pin), but for unknown reason it does not work for others pins => the "falling edge" log is printed continuously on the serial link, if I keep the button pressed the log stopped and restart infinitely when the button is unpressed
I tried to run this sample without any wires plugged in the board, for interrups pin 0,1,3 nothing is never log => OK
but for pin 2 and 5 same error
Is this a board issue ? is this normal ?
Many thanks for your help and sorry for my bad english
niorf:
With interrupt 0 each time I pressed the button the "Falling edge" log is printed on the console whereas with interrupt 5 the log is printed in loop
This reply does not answer the question. The question that Udo asked was whether you have enabled pullup resistors, or wired external resistors, so that you KNOW whether the interrupt pin is getting a definite +V or 0.
You said that, yes, you were enabling the pullup resistors, and showed your code to prove it. Well, as I look at your code, it proves that you have NOT enabled the pullup resistors on any pins.
Now, it would be helpful when you refer to pin numbers if you clearly distinguished between the number assigned to the pin on the board layout and the interrupt number that the pin may correspond.
When you say pin 0, I think of the pin that is part of the serial port instance. That pin 0 has extra resistors associated with it, and no user-accessible interrupt function.
So I re-explain my issue.
If I use the pin 18 for my interruption the toy motor will never spin and the log print in my "interrupt handler" is printed in loop.
If i use an another pin for interruption all works fine...
The fact that one of your interrupts is working to your satisfaction and one not, does not mean you do not have a problem with your wiring setup. The fact is that the hardware side of things must be correct before the software functions can work reliably and consistantly.
So how are you wiring your push button to your pin(s)? A drawing of some form would be the most help here Vs a written explanation of your wiring. If you do indeed lack pull-ups there are easy solutions at hand. Just slow down and try and answer the questions that have been given to you, there is a reason for these questions and will most likely help lead to success.
External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19 (interrupt 4), 20 (interrupt 3), and 21 (interrupt 2). These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.