digitalPinToInterrupt is not declared in this scope

Hello,

I tried to compile this code:

unsigned long beginTime = 0;
unsigned int dt = 0;
void setup() {
  Serial.begin(115200);
  while (!Serial);
  attachInterrupt(digitalPinToInterrupt(9), 9rising, RISING);
}

void loop() {
  Serial.println(dt, DEC);
  delay(500);
}


void 9rising() {
  beginTime = micros();
  detachInterrupt(digitalPinToInterrupt(9));
  attachInterrupt(digitalPinToInterrupt(9), 9falling, FALLING);
};

void 9falling() {
  dt = micros() - beginTime;
  detachInterrupt(digitalPinToInterrupt(9));
  attachInterrupt(digitalPinToInterrupt(9), 9rising, RISING);
};

But the compiler told me 'digitalPinToInterrupt' was not declared in this scope. So I looked in the pins_arduino.h file in .arduino15/packages/Intel/hardware/arc32/1.0.4/variants/arduino_101/ and I saw there was no macro or function definition for digitalPinToInterrupt.
Is there already a solution for this problem for the Arduino 101 or should I open an issue on Github?

Thank you,

S_v_L:
Hello,

I tried to compile this code:

unsigned long beginTime = 0;

unsigned int dt = 0;
void setup() {
  Serial.begin(115200);
  while (!Serial);
  attachInterrupt(digitalPinToInterrupt(9), 9rising, RISING);
}

void loop() {
  Serial.println(dt, DEC);
  delay(500);
}

void 9rising() {
  beginTime = micros();
  detachInterrupt(digitalPinToInterrupt(9));
  attachInterrupt(digitalPinToInterrupt(9), 9falling, FALLING);
};

void 9falling() {
  dt = micros() - beginTime;
  detachInterrupt(digitalPinToInterrupt(9));
  attachInterrupt(digitalPinToInterrupt(9), 9rising, RISING);
};



But the compiler told me `'digitalPinToInterrupt' was not declared in this scope`. So I looked in the pins_arduino.h file in `.arduino15/packages/Intel/hardware/arc32/1.0.4/variants/arduino_101/` and I saw there was no macro or function definition for digitalPinToInterrupt. 
Is there already a solution for this problem for the Arduino 101 or should I open an issue on Github?

Thank you,

Have you tried to just put the number?

You can use just the pin number as @edsa suggested (this usually works with all chips where all pins are IRQ enabled).
However, I'll file a pull request to 101 core to add the digitalPinToInterrupt macro to avoid the need to change existing sketches.

I just recently bought the 101 and the digitalPinToInterrupt macro is still not working.

I can confirm that this still hasn't been corrected. Im verifying with both the Uno, Micro, and Pro Mini when it throws the error.

@facchinm , were you able to create that pull request?

Yep! define digitalPinToInterrupt for backwards compatibility by facchinm · Pull Request #237 · arduino/ArduinoCore-arc32 · GitHub

Reinstall the arduino software. I also had the same problem. I solved that by downloading and reinstalling the arduino software.