INPUT_PULLUP for iterrupt

i am trying to use a hardware interrupt on the arduino mega with a pull up resistor. i can not find any way how to use the internal pull up resistor with the digital pin to interrupt syntax.

P.S. thanks in advance for any help

Which syntax is that? You probably don't need it. Use the high-level functions provided by Arduino.

The internal pullup should work on every interrupt pin.

i can not find any way how to use the internal pull up resistor with the digital pin to interrupt syntax.

It is

pinMode(pinNumber,INPUT_PULLUP);

Normally used in the setup. If you later go on to use that pin as an interrupt then the pull up still applies before it is routed through to the interrupt trigger.

gilliam: with the digital pin to interrupt syntax.

byte pin = 2;

pinMode(pin, INPUT_PULLUP);

attachInterrupt(digitalPinToInterrupt(pin), func, CHANGE);

So, you are using a internal pullup resistor on the interrupt pin. And you run the interrupt code, whenever the input pin changes (digital). Is that really what you want to do? If the signal goes low, it triggers, if the signal goes high, it triggers. May not be what you were wanting..

That's normally what you want for an encoder of course...