"PinChangeInt.h" / NO_PORTB_PINCHANGES working with PIN8 interrupt

Hello,

I'm very surprised by this code :

#include "PinChangeInt.h"
#define NO_PORTB_PINCHANGES //to go faster

void setup()
{

PCintPort::attachInterrupt(8, TS_EDGE,CHANGE);
...

Because it's running well and TS_EDGE is well triggered by a PIN 8 state change... PIN 8 is no more on the PORTB ?

Sev

That's because your define is not used. It must be defined before the include of "PinChangeInt.h" is done. Within a sketch this is very tricky as the IDE rearranges the defines and includes before the resulting file is fed to the compiler. Easiest way to get desired effect: move code to a separate file (not main file with setup and loop) and make the define and include there because these files are not touched by the IDE before compiling.

Thank you, I'll try this as soon as possible !

Tested Ok, just by inverting the two first lines, thanks a lot :slight_smile:

If the problem occur again (hard to detect), I'll put the first define in the H file :wink: