Problem using Arduino 2.2" TFT display

I have been playing with programming on the Arduino for a little less than a year, on and off. Now I'm trying to learn how to write my own code for an Arduino 2.2' TFT display MAR2201. I'm going off a project in the Arduino LCD projects by Robert J Davis II. In there he is using an HY-TFT240_262K display, but since that one uses the ILI9325C drivers and mine uses the ILI9225 drivers, I've only made a couple of changes to the code so far. Here is the code (I hope I put it in there correctly)
<//#include <memorysaver.h>
#include <UTFT.h>
#include <TFT_22_ILI9225.h>
// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];

UTFT myGLCD(ILI9225,19,18,17,16);
int Mv;
int OldMv;

void setup() {
// put your setup code here, to run once:
myGLCD.InitLCD();
myGLCD.clrScr();
}

void loop() {
// put your main code here, to run repeatedly:
// set color(Red, Green, Blue) range 0 to 255
myGLCD.setBackColor(0, 0, 0);
myGLCD.setFont(BigFont);
char buf[12];
while(I) {
// dislay millivolts in green text
Mv=analogRead(A0)/2.05;
myGLCD.setColor(0, 255, 0);
myGLCD.print(itoa(Mv, buf, 10), 16, 200);
// Turn old line red
if (OLDMv != Mv) {
myGLCD.setColor)255, 0, 0);
myGLCD.drawLine( 160, 240, OldMv, 0);
|
// Draw new white line
myGLCD.setColo(255, 255, 255);
myGLCD.drawLine( 160, 240, Mv, 0);
OldMv=Mv;
}; ..do nothing
}
}
}
}>
I got an error message that the 'ILI9225" was not declared in this scope. I'm not certain what they are calling for here. I've tried finding guidance online but so far have hit a blank wall. Any suggestions?

You didn't

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Going just from the code you posted, the error message would be correct. ILI9225 isn't declared anywhere. My assumption is that it probably should be declared or defined somewhere in the header referred to in "#include <TFT_22_ILI9225.h>". Open that file and look for ILI9225. I'll bet that it isn't defined/declared there either or that that file doesn't exist, in which case you are getting more error messages than you stated in your post.

Thank you, I see what your are saying about how I posted the code. I read through that and I think I've got it right this time.


#include <memorysaver.h>
#include <UTFT.h>
#include <TFT_22_ILI9225.h>
// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];

UTFT myGLCD(ILI9225, 19, 18, 17, 16);
int Mv;
int OldMv;


void setup() {
  // put your setup code here, to run once:
  myGLCD.InitLCD();
  myGLCD.clrScr();
}

void loop() {
  // put your main code here, to run repeatedly:
  // set color(Red, Green, Blue) range 0 to 255
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.setFont(BigFont);
  char buf[12];
  while (I) {
    // dislay millivolts in green text
    Mv = analogRead(A0) / 2.05;
    myGLCD.setColor(0, 255, 0);
    myGLCD.print(itoa(Mv, buf, 10), 16, 200);
    // Turn old line red
    if (OLDMv != Mv) {
      myGLCD.setColor)255, 0, 0);
      myGLCD.drawLine( 160, 240, OldMv, 0);
      |
      // Draw new white line
      myGLCD.setColo(255, 255, 255);
      myGLCD.drawLine( 160, 240, Mv, 0);
      OldMv = Mv;
    }; ..do nothing
  }
}
}
}

Is there a reference that explains how the commands are formatted and what they mean? I've been looking, but everything I've found so far makes it less clear than before. I played with BASIC over 30 years ago, but my job kept me so busy that I didn't get very far with it, but some of the commands looks similar. It's also been mentioned in several of the articles I've read that this is similar to C, which I haven't had time to play with, either.
I've looked through both the TFT_22_ILI9225.h and the UTFT.h and it looks like the ILI9225 is not defined in the UTFT.h. However, I did find a line that said #define NOT_IN_USE 24. Can I plug ILI9225 in that line?
I did try and verify the file after commenting out the UTFT.h since I had the TFT_22_ILI9225.h library in there, but not I get an error on the line UTFT myGLCD(ILI9225, 19, 18, 17, 16);
So, since I pretty much copied Robert Davis II's code line for line, with a couple of modifications, let me ask my questions in order. If I'm asking too may questions at one time, please tell me.

  1. There is a library included at the beginning called memorysaver.h. Is it really needed? I just found it online, but haven't had the time to read up on it.
  2. Since the ILI9225 is not in the UTFT library, how difficult is it to include it?
  3. myGLCD, is that a command peculiar to one of the libraries or is it defined someplace that explains its use?

I will probably have more questions as I go along, but I think that this is enough to start with.

Thank you for your help in advance.

@stalek, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the IDE 1.x category.

You indeed did :wink:

It is wise to post a link to the actual display that you have purchased. e.g. Ebay sale page.

I am guessing that you have this http://www.lcdwiki.com/2.2inch_Arduino_SPI_Module_ILI9225_SKU:MAR2201

but please confirm whether my guess is correct.

Then we can advise the best library to use and the most convenient way to connect the pcb to a Uno, Leo, Mega2560, Due, ...

David.

That is the correct board.

The link that I posted shows you how to plug the board into a Uno or a Mega2560.
And it provides links to LCDWIKI libraries. And all the necessary instructions. LCDWIKI examples should work.

Please let us know how you get on. LCDWIKI works but is a bit crap. But the LCDWIKI page in #6 does give very clear instructions,
Get LCDWIKI running 100% and we can point you to libraries that are not badly-spelled.

David.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.