Quantcast
Channel: Seeedstudio Forum
Viewing all articles
Browse latest Browse all 6612

2.8 TFT V2 Touch Screen Need a Library

$
0
0
Hello James,

I'll assume you are using the example programs supplied by Seeed.

I don't have a drawText function - did you mean drawChar?

I just ran both the "text" example which uses drawChar, and the "drawNumber" example and have no compile errors.

Your error message refers to line 284 of TFTv2.cpp: TFTv2.cpp.284:undefined reference to 'simpleFont'.
In that file, line 284 is: INT8U Hcolor = color>>8;, which is part of the "...fillscreen..." routine that starts at line 251.

I find the reference to simpleFont at line 356, "INT8U temp = pgm_read_byte(&simpleFont[ascii-0x20][i]);", which is part of the drawChar routine which starts at line 345.

Since your original post indicated you just picked up the display, I wonder if Seeed changed something in their example programs. But even so, the error line reported, 284, does not match what's in my .cpp library file.


Regards,
John

PS: Here's the "text" example I have:

/* draw text's APP
drawChar(INT8U ascii,INT16U poX, INT16U poY,INT16U size, INT16U fgcolor);
drawString(char *string,INT16U poX, INT16U poY,INT16U size,INT16U fgcolor);
*/

#include <stdint.h>
#include <TFTv2.h>
#include <SPI.h>

void setup()
{
TFT_BL_ON; // turn on the background light
Tft.TFTinit(); // init TFT library

Tft.drawChar('S',0,0,1,RED); // draw char: 'S', (0, 0), size: 1, color: RED

Tft.drawChar('E',10,10,2,BLUE); // draw char: 'E', (10, 10), size: 2, color: BLUE

Tft.drawChar('E',20,40,3,GREEN); // draw char: 'E', (20, 40), size: 3, color: GREEN

Tft.drawChar('E',30,80,4,YELLOW); // draw char: 'E', (30, 80), size: 4, color: YELLOW

Tft.drawChar('D',40,120,4,YELLOW); // draw char: 'D', (40, 120), size: 4, color: YELLOW

Tft.drawString("Hello",0,180,3,CYAN); // draw string: "hello", (0, 180), size: 3, color: CYAN

Tft.drawString("World!!",60,220,4,WHITE); // draw string: "world!!", (80, 230), size: 4, color: WHITE


}

void loop()
{

}

Statistics : Posted by james.roth • on Sat Jun 07, 2014 6:24 pm • Replies 7 • Views 173

Viewing all articles
Browse latest Browse all 6612

Trending Articles