[int variable] was not declared in this scope

I defined variables in the void setup section:
int PumpPin=13;

In the loop section:
digitalWrite(PumpPin,HIGH);

Compilation error: 'PumpOn' was not declared in this scope

Make sure all the names match, and that all are declared.
You are likely missing
byte PumpOn;
at the top of your sketch.

If you declare within setup then the variable is local to setup and won’t “work” outside of it .
You need to declare it before setup , then it will be global everywhere .

Compilation error: ‘PumpOn’ was not declared in this scope

PumpPin is not the same as PumpOn.

Hi,
I think we need to see your code to give you a proper answer?

Thanks... Tom... :slight_smile:

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