Go Down

Topic: Simple Interrupt (Read 1 time) previous topic - next topic

bullethole

When you say "configure the pin a little bit"  what do you mean.  I've tried writing HIGH to it after configuring it to be an input pin, which as far as I can tell should enable the internal pullup resistor.  I changed the interrupt to trigger on CHANGE, which should mean that the button becomes low, and changes the state.

bullethole

I changed my circuit to not use the +5v output on the board, powering the switch with 4 AA bateries, and now with CHANGE as the trigger,  things seem to work better.

deSilva

#7
Aug 27, 2010, 01:50 am Last Edit: Aug 27, 2010, 01:51 am by mpeuser Reason: 1
(1) You have to use a pull-up or pull-down. Please understand this.
(2) If you do not want to use an external resistor, there is only the pull-up solution.
(3) Hence the button must be connected to ground, what is called "active low" by us nit-wits.
(4) So to catch this with an interrupt, you have to look for a falling edge..

Yes, I think this might work..


Senso

And then the mighty deboucing kicks in, or the mechanical vibration of the switch will trigger alot of interrupts every time that you press the button.

deSilva

Why not? We don't know what the program is assumed to do. Maybe it's a "bounce-counter"?

Go Up