Demo sketch wnt compile

Am complete noob and been given a mega r3 and a 3.2 touchscreen but cnt seem to get the code to compile, can you see any errors with it please

  • #include <ITDB02_Graph16.h>

#define LCD_RS 38
#define LCD_WR 39
#define LCD_CS 40
#define LCD_REST 41

#define DCLK 6
#define CS 5
#define DIN 4
#define DOUT 3
#define IRQ 2

unsigned int TP_X,TP_Y;

// Declare which fonts we will be using
extern uint8_t SmallFont;
//extern uint8_t BigFont;
// Uncomment the next line for the ITDB02 Shield
//ITDB02 myGLCD(19,18,17,16);

// Uncomment the next line for the ITDB02 Mega Shield
ITDB02 myGLCD(38,39,40,41);

void setup()
{
randomSeed(analogRead(0));

// Setup the LCD
myGLCD.InitLCD(LANDSCAPE);
myGLCD.setFont(SmallFont);
//myGLCD.setFont(BigFont);
}
int cle =1;
void loop()
{
int buf[318];
int x, x2;
int y, y2;
int r;

// Clear the screen and draw the frame
if(cle==1)
{
myGLCD.clrScr();
}
cle=0;

myGLCD.setColor(255,0,0);
myGLCD.print(“Welcome to the colour world :)”, LEFT, 207);
myGLCD.print(“Thank u 4 shopping at Etang Electronics”, LEFT, 227);
// myGLCD.setBackColor(0, 0, 0);//black
// myGLCD.setBackColor(255, 255, 0);//black
// Draw some filled, rounded rectangles
for (int i=1; i<6; i++)
{
switch (i)
{
case 1:
myGLCD.setColor(255,0,255);//yellow
break;
case 2:
myGLCD.setColor(255,0,0);//red
break;
case 3:
myGLCD.setColor(0,255,0);//green
break;
case 4:
myGLCD.setColor(0,0,255);//blue
break;
case 5:
myGLCD.setColor(255,255,0);//pink
break;
}
myGLCD.fillRoundRect(190-(i20), 30+(i20), 250-(i20), 90+(i20));
}

delay(15000);

}

You didn't post the errors.

And you didn't post the code in code tags.

'ITDB02' does not name a type

sketch_jun07a:23 error 'ITBDO2' does not name a type sketch_jun07a.ino In function 'void setup()': sketch_jun07a:30 error 'myGLCD' was not declared in this scope sketch_jun07a.ino: In function 'void loop()': sketch_jun07a:45: error 'myGLCD' was not declared in this scope sketch_jun07a:49: error 'myGLCD' was not declared in this scope sketch_jun07a:50: error 'LEFT' was not declared in this scope

Which folder did you install the library in ?
Please give the exact path.

Did you follow the instructions given in http://arduino.cc/en/Guide/Libraries ?

That was sent to me as a text so just copied then pasted into Arduino then pressed compile

You need to download and install the ITDB02_Graph16 library.

Tried to install the UTFT Library but even it kicks up errors when compiling to upload

core.a(main.cpp.o) : In function 'main': C:/Program Files (x86)\Arduino\hardware\arduino\cores\arduino/main.cpp:5: undefined reference to 'setup' C:\Program Files (x86) \Arduino\hardware\arduino\cores\arduino/main.cpp:15: undefined reference to 'loop'

Think i'm doing it right as have had a demo i found online upload and run fine on the arduino

pecker115: Tried to install the UTFT Library but even it kicks up errors when compiling to upload

core.a(main.cpp.o) : In function 'main': C:/Program Files (x86)\Arduino\hardware\arduino\cores\arduino/main.cpp:5: undefined reference to 'setup' C:\Program Files (x86) \Arduino\hardware\arduino\cores\arduino/main.cpp:15: undefined reference to 'loop'

Think i'm doing it right as have had a demo i found online upload and run fine on the arduino

Libraries are intended to be be compiled for uploading; their intended to be included from sketches which contain, at minimum, a setup() and loop() function.

Surely though the demo i posted should of compiled at least without the UTFT library, if i can get that demo to run then hoping i can start to understand it a bit more

pecker115: Surely though the demo i posted should of compiled at least without the UTFT library, if i can get that demo to run then hoping i can start to understand it a bit more

If you had the ITDB02_Graph16 library installed correctly, there's a good chance it would have.

That’s what i’m trying to figure out where i’m going wrong then hopefully i’ll understand it a bit better, i’ve followed the instructions on the main arduino site for installing libraries

pecker115: That's what i'm trying to figure out where i'm going wrong then hopefully i'll understand it a bit better, i've followed the instructions on the main arduino site for installing libraries

If you want help, you're going to need to start answering questions from people who are trying to help:

UKHeliBob: Which folder did you install the library in ? Please give the exact path.

I left the path as arduino ide set it when i installed it, then sketch,import library, add library so it should be put where it needs it??

In preferences its set for sketchbook location as c:\Users\Paul\Documents\Arduino

The touch screen and shield i got was this 1 http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=111043788980&ssPageName=ADME:X:RTQ:GB:1123 it was the seller that sent me that demo code that i was told needed just that to run

pecker115: I left the path as arduino ide set it when i installed it, then sketch,import library, add library so it should be put where it needs it??

The Arduino IDE doesn't install libraries.

In preferences its set for sketchbook location as c:\Users\Paul\Documents\Arduino

It should be in a libraries sub directory within the sketchbook folder.

The touch screen and shield i got was this 1 http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=111043788980&ssPageName=ADME:X:RTQ:GB:1123 it was the seller that sent me that demo code that i was told needed just that to run

They probably meant "you just need this code to create a sketch to run the device", not "compile this code and it will run".

The seller did say just run that code and the demo will run on the screen just to show the screen working as the 1st 1 he sent didnt work which when i returned and he tested with that code didnt work, so sent replacement,now using it,which he tested before shipping, worked ok,but i'm the noob struggling to even compile the demo he sent. So if i open sketchbook folder, add a sub folder named libraries and put the UTFT Library in there??

this is instructions i followed for adding libraries http://arduino.cc/en/Guide/Libraries

pecker115:
The seller did say just run that code and the demo will run on the screen just to show the screen working as the 1st 1 he sent didnt work which when i returned and he tested with that code didnt work, so sent replacement,now using it,which he tested before shipping, worked ok,but i’m the noob struggling to even compile the demo he sent.

Since I have no idea what he sent you, I can’t speak to that.

So if i open sketchbook folder, add a sub folder named libraries and put the UTFT Library in there??

Yes. It should look something like this:

<SKETCHBOOK>
  libraries
    libaryName
      examples
      libraryName.cpp
      libraryName.h
      keywords.txt
      ...

The sketch he sent me is at the top of the post as a text file i just copied and pasted into arduino ide as he instructed

pecker115: The sketch he sent me is at the top of the post as a text file i just copied and pasted into arduino ide as he instructed

If you're referring to the code in your first post, it still requires a library to be properly installed.