digitalPintoInterrupt not declared in this scope

Hi guys,

I have some code here that keeps giving me the error message "digitalPintoInterrupt not declared in this scope" even though I've declared it in the setup function. I'm trying to read data from a digital pin connected to track speed of a wheel.

#define reedPin 2
const int sampleInterval = 2000;      // duration of sensor reading (ms)

int reedVal;
int reedCounter;
float radius = 8.5;
float circumference = 2 * 3.14 * radius;

float mph;

int numRotations;           // keep track of rotations to get speed
float windSpeed;            // vars for data
long prevMillis = 0;        // keep track of interval for reading/upload

void setup() {
  // speed sensor pin setup
  pinMode(reedPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(reedPin), updateSpeed, FALLING);

void loop() {

  // if time, get sensor reading
  if (millis() > prevMillis + sampleInterval) {
    // calculate wind speed
    reedVal = digitalRead(reedPin);
    if (reedCounter == 0){
      mph = (56.8 *circumference) / sampleInterval;           // convert from pulses to mph
    // reset timer and counter
    prevMillis = millis();
    numRotations = 0;

// function to run when speed interrupt is triggered
void updateSpeed() {
  mph = mph;

Don't know about the scope problem, but you will find that Serial.print doesn't work in an ISR. Interrupts are disabled in an ISR and Serial.print depends on interrupts. Set a flag in the ISR, do your printing in loop() and clear the flag.

When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here using code tags.

FYI, you didn't declare it, you called it. However that function is typically defined in the variant file for the selected board.

function is typically defined in the variant file for the selected board.

Which means, we need to know what board type you are trying to use...

Where in your code do you count pulses?

If you weren't getting the error, you would be seeing a constant 1.52 as the speed. Although without Serial.begin() you won't be seeing anything.

What version of the IDE are you using. Some of the very old versions do not support the syntax attachInterrupt(digitalPinToInterrupt(), isr, mode)