Does your switch work? You’ve not enabled pullups and told us how you’ve wired the switch.
Yes, the code switch works perfectly.
The switch button is connected like this:
The red wire are connected in PB1
The black wire are connected in PB2
The white wire are connected in PB0
The red yellow are connected in GND
(I am using this lot of wire to be able to test with the LEDS)
I did not activate pullup because I did not know what it is and what it is for. Can you explain me?
In the serial monitor it is writing "hey, its changed" in loop, for ever...
The switch button is connected like this: The red wire are connected in D09 The black wire are connected in D10 The white wire are connected in D08 The red yellow are connected in GND
LOL -- how does that help? Is your switch wired active-high or active-low? Is there a pulling resistor one way or the other? Four wires for a switch?
What is D08/D09/etc.? Arduino digital pins? What AVR pins do they correspond to?
You can put lipstick on a pig, but it is still a pig.
I've never met a pig I didn't like, as long as you have some salt and pepper.
The switch pulls the port pin low, what pulls it high? This means your port pin ‘floats’ and has no determinable logic level so even just looking at the port pin may change its state.
For PORTB0, enable the pullup by PORTB |=1;
Really you're right, sorry for the mess. I tried to edit to make it clearer.
I think I've begun to understand what you're saying. I have some resistors and 4 pin buttons here. How would I mount to test all 4 of these interrupt types?
Being an Arduino, there must be a zillion examples to connect pushbuttons and leds. Here you are doing advanced interrupts, but yet you’ve skipped the basic hardware interface.
 10 seconds of googling arduino pushbutton got this:
Google arduino led
And that should solve how to connect leds properly.
220 ohm and 150ohm resistors?
Fine for leds, probably not so good for your pushbutton switch.
Four pin push buttons usually have pins connected together in pairs. Check it with an multimeter (on ohm or continuity setting).
Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net
Why on earth would you wire it like that?
Especially since i’ve given him two valid options.
My God, there must be a lack of understanding here or they do not understand me or I do not understand them.
Like, what is the model of this switch, with two pairs of legs tied together?
And why wouldn't you just connect the switch to Gnd and use the internal pullup, and work active-low?
Yes, external interrupts work pretty much as you summarized. But my god, to what end? Buttons bounce, so you don't get clean results with external interrupt. Low-level repeats itself, and is pretty much passe since pin-change will awaken an AVR. Any pin chan do "change" with [wait for it] pin-change. Other mechanisms can be used for edge selection, including analog comparator and timer-as-counter.
© 2018 Microchip Technology Inc.