'pulseCounter was not declared in this scope' error message without knowing why

So I'm using an Arduino Uno, a 162LCDBLACK LCD screen, a YF201-C water flow sensor and a small breadboard for a product I'm making. It's made for displaying the amount of water that goes through the water flow sensor and I want to add 3 lights that turn on/off after an amount of water used, but when programming I came across the 'pulseCounter was not declared in this scope' error message. Just when verifying the code so no electronics that have anything to do with this. See code below:

   
**if (totalLitres >= 60) {                // if the total amount of L used is more than 60L, than red LED gives light**
**      digitalWrite(ledPINR, HIGH);**
**    }**

**    else if (totalLitres >= 30 && <= 60)  { // if the total amount of L used is more than 30L and less than 60L, than the orange LED gives light**
**      digitalWrite(ledPINO, HIGH);**
**      digitalWrite(ledPING, LOW);**
**    }**

**    else (                                  // if the total amount of L used is below than 30L, than the green LED gives light**
**        digitalWrite(ledPINO, LOW);**
**        digitalWrite(ledPING, HIGH);**
**    }**

  // Reset the pulse counter so we can start incrementing again
  pulseCount = 0;



  // Enable the interrupt again now that we've finished sending output
  attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
  Serial.print(flowRate, DEC); // Print litres/hour
  Serial.println(" L/minute");
  Serial.println(totalMilliLitres);
  Serial.println(totalLitres);
}
}

/*
  I.S.R.
*/
void pulseCounter()
{
  // Increment the pulse counter
  pulseCount++;
}

So it's about the bold part of the code, if that code is there I get the error and when I remove it, I don't get the error. Does anyone know why this is happening?

    else (<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< is supposed to be something else and not a (                                  // if the total amount of L used is below than 30L, than the green LED gives light**
**        digitalWrite(ledPINO, LOW);**
**        digitalWrite(ledPING, HIGH);**
**    }**

each { must have a } and each ( must have a ).

Oh wow it's this small, thank you very much. took me so long to figure out haha. did not notice it. I know each { needs } and ( needs ) but just didn't notice it

Hi,
here is also an error:
" else if (totalLitres >= 30 && <= 60) ",
shall be:
else if (totalLitres >= 30 && totalLitres <= 60)

Yes thankyou. I saw that too after I fixed the first mistake and this is also fixed now. But still thank you!

Auto-format would have shown the error.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.