# Not declared in scope

**URL:** <https://forum.arduino.cc/t/not-declared-in-scope/409880>\
**Category:** Programming\
**Created:** [September 26, 2016, 5:09pm UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880 "2016-09-26T17:09:01Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohemfishy](https://avatars.discourse-cdn.com/v4/letter/o/0ea827/32.png) [@ohemfishy](https://forum.arduino.cc/u/ohemfishy)\
**Post date:** [September 26, 2016, 5:09pm UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880/1 "2016-09-26T17:09:01Z")

</div>

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:

```cpp
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:

```cpp
#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!

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [September 26, 2016, 5:12pm UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880/2 "2016-09-26T17:12:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![GypsumFantastic](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/gypsumfantastic/32/236274_2.png) [@GypsumFantastic](https://forum.arduino.cc/u/GypsumFantastic)\
**Post date:** [September 26, 2016, 5:12pm UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880/3 "2016-09-26T17:12:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mjward](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@mjward](https://forum.arduino.cc/u/mjward)\
**Post date:** [September 26, 2016, 5:32pm UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880/5 "2016-09-26T17:32:58Z")

</div>

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

--Michael

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [September 26, 2016, 5:43pm UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880/6 "2016-09-26T17:43:06Z")

</div>

> mjward:  
> Arrays will not save the OP.

That is not was said 😉

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

---

<div class="post-metadata">

**Author:** ![mjward](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@mjward](https://forum.arduino.cc/u/mjward)\
**Post date:** [September 26, 2016, 5:45pm UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880/7 "2016-09-26T17:45:20Z")

</div>

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

Best,  
Michael

---

<div class="post-metadata">

**Author:** ![mjward](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@mjward](https://forum.arduino.cc/u/mjward)\
**Post date:** [September 26, 2016, 6:35pm UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880/9 "2016-09-26T18:35:43Z")

</div>

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. 😉  
--Michael

---

<div class="post-metadata">

**Author:** ![rpt007](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/rpt007/32/222524_2.png) [@rpt007](https://forum.arduino.cc/u/rpt007)\
**Post date:** [September 26, 2016, 7:12pm UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880/10 "2016-09-26T19:12:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rpt007](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/rpt007/32/222524_2.png) [@rpt007](https://forum.arduino.cc/u/rpt007)\
**Post date:** [September 26, 2016, 7:17pm UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880/12 "2016-09-26T19:17:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ohemfishy](https://avatars.discourse-cdn.com/v4/letter/o/0ea827/32.png) [@ohemfishy](https://forum.arduino.cc/u/ohemfishy)\
**Post date:** [October 7, 2016, 5:13pm UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880/13 "2016-10-07T17:13:29Z")

</div>

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...

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [October 7, 2016, 6:20pm UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880/15 "2016-10-07T18:20:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MarkT](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@MarkT](https://forum.arduino.cc/u/MarkT)\
**Post date:** [October 7, 2016, 7:32pm UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880/16 "2016-10-07T19:32:43Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![ohemfishy](https://avatars.discourse-cdn.com/v4/letter/o/0ea827/32.png) [@ohemfishy](https://forum.arduino.cc/u/ohemfishy)\
**Post date:** [October 7, 2016, 11:33pm UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880/17 "2016-10-07T23:33:31Z")

</div>

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!!!

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [October 8, 2016, 5:30am UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880/18 "2016-10-08T05:30:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 5, 2021, 10:06pm UTC](https://forum.arduino.cc/t/not-declared-in-scope/409880/19 "2021-05-05T22:06:06Z")

</div>

Closed on May 5, 2021, 10:06pm UTC


