Interrupts on Rainbowduino

Hi

I am planning to use an extension board with the Rainbowduino. For that I need to use a free interrupt. I was not able to find that information in the documentation. Could please anybody help me which digital pin (D3, D2) is connected with which internal interrupt? And which one is free to use?

Thanks and Cheers,
Adrian

Its a Arduino. Use the interrupt functions for atmega328

It seems so you don’t understand the function of interrupts. Check avr manual :wink:

Both of them are free, both of them can execute an interrupt sub routine. Just configure it right. Check avr manual!

Ermm, no, I am probably just using the wrong wording or worded my question unclear. Sorry for that. :slight_smile:

Let’s try again:

On some Arduino clone I have a pullup resistor on pin 2 and this code:

pinMode(2, INPUT);
digitalWrite(2, HIGH);
attachInterrupt(0, called_on_data, RISING);

Which means that I get an interrupt when there is data on digital pin 2.

But digital pin 2 is not always interrupt 0. Not so much on Nanodes as well as on Teensy (where it is pin 7 and interrupt 2, as example).

Which brings me back to my initial question:

If I use the D2 pin on the Rainbowduino Board. Will I have to use the interrupt 0? Or is this different with the Rainbowduino v3?

And regarding the free: If some piece of code already attached a callback method on say, interrupt 0, it is not very wise to attach my own code on interrupt 0 as well. The Nanode - as example - already has an interrupt reserved (and attached) for the network interface. That example for explaining why I asked about “free”. :slight_smile:

Regards and thanks,
Adrian

Ok…

atmega328 aka Arduino has 2 external interrupts. PD2 and PD3 aka 0 and 1 in Arduino IDE. Rainbowduino use also a atmega328 :wink:
Its always the same port/alias except you use another chip like atmega32u4 aka teensy!

This wouldn’t work. I think Arduino IDE show you an error if you try this (multiple ISR defined).
But its free by default. If you use librarys in your project just take a look in the .cpp file.