Old code now gives error when verified

I am using a photoresistor and my code errors out on the power pin line, this code worked before but I had a problem and had to rewrite the code to my Phonton and now I get this error when verifying.

Here is where I declare power:: int power = A5;

Here is my code line:: pinMode(power, OUTPUT);

Here is the error:: reference to 'power' is ambiguous

I just commented out that line, and photo resistor doesn't work without it. Not sure how to fix this error.

This means there is also some other definition for power in that project.
Typically the build log also contains additional notes about all the occurances for the ambigous term.

The simple solution is to choose an alternative name (e.g. const int pinPwr = A5;) and then use that instead.

4 Likes

That fixed it, thanks for your help.

1 Like