title: Arduino 2D array too large (TFT touch lcd)
body: <p>I'm currently using a TFTv2 Seeedstudio Shield with an Arduino Mega 2560. I was making it draw things on the screen when I realized there was no method to get the color of a pixel. My immediate thought was to go into the library files and add a method that would return the color (one integer) that corresponds to the pixel at <code>(x, y)</code>. The number of pixels on the screen is 240 * 320 = 76800. When I make an array that has an index of 76800, the sketch compiles just fine:</p>
  
  <pre><code>INT16U pixels[76800];
  </code></pre>
  
  <p>but:</p>
  
  <pre><code>INT16U pixels[320][240];
  </code></pre>
  
  <p>is a no-no.</p>
  
  <p>I get an error saying that the array size is too big.</p>
  
  <p>The only other things I changed in the TFTv2.cpp file are the <code>setPixel(int x, int y, int color)</code> method and I added a method called <code>getColorAt(int x, int y)</code> which returned an <code>unsigned int8</code>. I also added the method in the TFTv2.h header file. Here are these changes:</p>
  
  <p>Header file:</p>
  
  <pre><code>INT16U getColorAt(INT8U poX, INT8U poY);
  </code></pre>
  
  <p>CPP file:</p>
  
  <pre><code>void TFT::setPixel(INT16U poX, INT16U poY,INT16U color)
  {
      setXY(poX, poY);
      pixels[poX][poY] = color; //added this line myself
      sendData(color);
  }
  
  INT8U TFT::getColorAt(INT8U poX, INT8U poY)
  {
      return pixels[poX][poY];
  }
  </code></pre>
  
  <p>What is the difference here? I thought a two-dimensional array would hold the same amount of data that a single array with the same number of indices would.</p>
  
  <p>Any input is appreciated, and if you need any other information, please do not hesitate to ask!</p>