Not declared in scope

I’ve only worked on Arduino one time before so I’m not very good at troubleshooting this code. This is someone else’s code and so I’ve just been trying to fix it for my internship. I am currently using an Arduino Uno to make a cable tester which basically just checks if all 26 pins in our cables can cycle power. I keep getting an error saying:

Arduino: 1.6.11 (Windows 10), Board: "Arduino/Genuino Uno"

check_output:3: error: 'A10' was not declared in this scope

 LiquidCrystal lcd(A10,A11,A12,A13,A14,A15);

                   ^

check_output:3: error: 'A11' was not declared in this scope

 LiquidCrystal lcd(A10,A11,A12,A13,A14,A15);

                       ^

check_output:3: error: 'A12' was not declared in this scope

 LiquidCrystal lcd(A10,A11,A12,A13,A14,A15);

                           ^

check_output:3: error: 'A13' was not declared in this scope

 LiquidCrystal lcd(A10,A11,A12,A13,A14,A15);

                               ^

check_output:3: error: 'A14' was not declared in this scope

 LiquidCrystal lcd(A10,A11,A12,A13,A14,A15);

                                   ^

check_output:3: error: 'A15' was not declared in this scope

 LiquidCrystal lcd(A10,A11,A12,A13,A14,A15);

                                       ^

exit status 1
'A10' was not declared in this scope

This is my code:

#include <LiquidCrystal.h>

LiquidCrystal lcd(A10,A11,A12,A13,A14,A15);
;
void setup() {
  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
  pinMode(14, OUTPUT);
  pinMode(15, OUTPUT);
  pinMode(16, OUTPUT);
  pinMode(17, OUTPUT);
  pinMode(18, OUTPUT);
  pinMode(19, OUTPUT);
  pinMode(20, OUTPUT);
  pinMode(21, OUTPUT);
  pinMode(22, OUTPUT);
  pinMode(23, OUTPUT);
  pinMode(24, OUTPUT);
  pinMode(25, OUTPUT);
  
  
  pinMode(28, INPUT);
  pinMode(29, INPUT);
  pinMode(30, INPUT);
  pinMode(31, INPUT);
  pinMode(32, INPUT);
  pinMode(33, INPUT);
  pinMode(34, INPUT);
  pinMode(35, INPUT);
  pinMode(36, INPUT);
  pinMode(37, INPUT);
  pinMode(38, INPUT);
  pinMode(39, INPUT);
  pinMode(40, INPUT);
  pinMode(41, INPUT);
  pinMode(42, INPUT);
  pinMode(43, INPUT);
  pinMode(44, INPUT);
  pinMode(45, INPUT);
  pinMode(46, INPUT);
  pinMode(47, INPUT);
  pinMode(48, INPUT);
  pinMode(49, INPUT);
  pinMode(50, INPUT);
  pinMode(51, INPUT);
  pinMode(52, INPUT);
  pinMode(53, INPUT);


lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("Cable Test");
lcd.setCursor(0,1);


 int i=0, j=28,check_below=0, check_short=0, save_marker=0;
  
 
 while(i<=25&&j<=53)
 {
  digitalWrite(i, HIGH);
  
  save_marker=j;
  for(int x=27; x<=53; x++)
  {
    check_short=digitalRead(x);
    if(x!=save_marker&&check_short==HIGH)
    {
      lcd.print("Failed:Short");
      break;
    }
    else
    {
      continue; 
    }
  }
  
  if(digitalRead(j)==HIGH)
  {
    digitalWrite(i,LOW);
    
    i++;
    j++;
    if(i==26)
      {
        lcd.print("Passed");
        break;
      }
     else
     {
      continue;
      } 
    
     
  }   
  
  else
  {
    
    lcd.print( "FAILED:Continuity");
     
    break; 
  }
 }
 
   
 }
 void loop()
 {
 }

Would appreciate any kind of help of suggestions! Thank you in advance!

What kind of Arduino are you compiling for? I'm not aware of any Arduinos with 15 analog pins.

The Arduino UNO doesn't have pins A10, A11, A12 etc

Judging from other pins used in the code, it seems like the OP needs to set the IDE tools to the right board. And then he needs to read about arrays.

This code appears to have been written for a Mega not Uno. Arrays will not save the OP.

--Michael

mjward:
Arrays will not save the OP.

That is not was said :wink:

It will however reduce all those pinMode statements to 8 or less lines.

Still, it won't do him/her any good to try to run it on an Uno.

Best,
Michael

mjward:
Still, it won't do him/her any good to try to run it on an Uno.

Best,
Michael

You may want to brush up on your reading skills. That was given as the NEXT thing the OP needs to learn, not a solution to this problem. Hence the "Then" at the beginning of that line implying that as a next step after solving this.

Well, since we've now decayed to a state who said what, the first thing said was:

it seems like the OP needs to set the IDE tools to the right board

...which also will do no good if the OP is trying to program an Uno. :wink:
--Michael

The error occurs due to a wrong setup of the lcd constructor, which is apparently for another Arduino (Mega?).
In addition we should exactly get to know what lcd library is being used, and what lcd display is to be connected, to get an idea about the right constructor and the wiring.

rpt007:
The error occurs due to a wrong setup of the lcd constructor, which is apparently for another Arduino (Mega?)
In addition we should exactly know what lcd library is used, to get an idea about the right constructor.

No, he can use that constructor but he must use pin numbers that are defined for the board he is compiling for.

Sorry, my fault.
I didn't mean that the constructor as such is wrong but the wrong pins being used in the constructor.

Nevertheless we should see how the wiring looks like as the OP doesn't seem to know the relationship of the constructor and the adequate Arduino pins.

So to fix it, would I need to just redefine the pin numbers in my code? Also, how would I reduce the number of pins used?


Sorry for the late response. Lost the thread because I still don't know how to use the forum...

ohemfishy:
So to fix it, would I need to just redefine the pin numbers in my code? Also, how would I reduce the number of pins used?


Sorry for the late response. Lost the thread because I still don't know how to use the forum...

Don't know. There's still so much you haven't said. Read above about some questions that were raised. Namely, which board are you using and what you have connected and how.

Easiest way is to get a mega (or whatever the original code was written for). You will have to sacrifice most of the testing capabilities if you stay with the uno.

The lcd needs 7 pins. Leaves yo with 7 digital pins and the 6 analog pins for i/o. There might be a button which you need to subtract and for debugging you might want to keep the serial port free for debugging.

If you want to redesign the complete system based on the uno, consider the use of i2c or spi port expanders or of shift registers.

I did not look at the code as I'm using phone at this moment.

PaulS:
What kind of Arduino are you compiling for? I'm not aware of any Arduinos with 15 analog pins.

Indeed, the Mega has 16

I switched to a Mega and just managed to upload the code! But my LCD display isn't showing anything, but that might just be another problem perhaps? I think I should be posting this part of my troubleshooting to another thread.

Thanks a bunch!!!

Check the wiring, double check the wiring, triple check the wiring.

If you think it's OK, use the original code that was given to you as that (I assume) should work.

If it doesn't, check the wiring again.