'myGLCD' does not name a type

so i got every other part of the code listed below to be working, but the part that reads myGLCD.fillScr(VGA_RED); returns the error:

'myGLCD' does not name a type

i have no idea what the brand of screen im using is but it has a label saying: 2.6"/2.8" TFT LCD Sheild

i am using Arduino Mega 2560


#include <memorysaver.h>
#include <UTFT.h>

#include <SD.h>
#include <Wire.h>
#include <memorysaver.h>

UTFT myGLCD(0xC505,A2,A1,A3,A4);
int ScreenXSize = myGLCD.getDisplayXSize();
int ScreenYSize = myGLCD.getDisplayYSize();
//UTFT setBrightness(8);

byte HomeButton = 33;
byte HomeButtonPress = 42;
byte Torch = 30;
byte Sound = 24;
byte RedLight = 46;
byte GreenLight = 48;
int Freq = 50;
bool Frequp = true;

void setup() {
  // put your setup code here, to run once:
  int ScreenXSize = myGLCD.getDisplayXSize();
  int ScreenYSize = myGLCD.getDisplayYSize();
  pinMode(HomeButton, OUTPUT);
  pinMode(HomeButtonPress, INPUT_PULLUP);
  pinMode(Torch, OUTPUT);
  pinMode(Sound, OUTPUT);
  pinMode(RedLight, OUTPUT);
  pinMode(GreenLight, OUTPUT);

void loop() {
  // put your main code here, to run repeatedly:
  if (Frequp){
    Freq += 5;
    if (Freq > 2699) {
      Frequp = false;
  if (Frequp == false) {
    Freq -= 5;
    if (Freq < 51) {
      Frequp = true;
  digitalWrite(HomeButton, !(digitalRead(HomeButton)));
  if (digitalRead(HomeButtonPress) == 0){
    digitalWrite(Torch, HIGH);
    tone(Sound, Freq);
  } else {
    digitalWrite(Torch, LOW);

UTFT uses small integers to specify "Model" e.g. 0 .. 33
It defines several obvious names to correspond with each model number e.g. ILI9341_16 means controller is ILI9341 with 16-bit parallel interface.

It also defines gobbledygook names like ITDB32S which correspond to specific models from a specific make e.g. Itead Studio.

There is no way that a large integer like 0xC505 could ever be a model number.

If your display has come from the big names like Itead or ColdTears, you can possibly find the number from your invoice.

If it is unbranded, post a link to the Ebay Sale or post a photo of the pcb side of the screen.


i dont know the seller either, it was a Christmas present,

also, ive tried setting it to different model types with the same error

The error isn't about the type. The error is about this line:


which needs to be inside a function but isn't. There's another one like it here:


Out there at global scope you can create new variables and initialize them as long as you do it on the same line. But you can't have executable lines of code or call functions.

ok its half working now, i still cant figure out the model type. here are the photos of the front and back

both chips say:


You have a regular Blue 2.8 inch Mcufriend shield. Some have a white pcb.

Install MCUFRIEND_kbv library via the Library Manager.

This will tell you which controller is mounted i.e. its ID.

Post the results. We can then tell you if/how it will work with UTFT.


i dont know how to use it

Explain what you mean by:

i dont know how to use it

e.g. how to use the Library Manager
e.g. how to plug a shield into a Uno
e.g. how to run a library example