2.8 TFT V2 Touch Screen Need a Library

Thought it would fun to play with Arduino and TFT touchscreen. First attempt at anything like this and I can’t find the “stdint” library to include in any of the example sketches. Not in the Arduino standard or contributed libraries (checked their web pages). I have all the others: “SPI”, “Streaming”, “TFTv2”, “SeeedTouchScreen”. Where can I download the library “stdint”?? Really frustrating for a 70 year old trying this for a hobby.

The stdint.h library is built into the IDE. You don’t need to manually install it. The demos will run as supplied.

Regards,
John

Thanks John,
Tried just running the example sketches and they ran perfectly. Then I commented out the #include and it still ran, so those functions are indeed in the 1.0.5 IDE. Thanks for the reply
James

James,

Glad I could be of some help.

If you want to rotate the text, below is a link to my modified V2 libraries.

Regards,
John

http://forum.arduino.cc/index.php?topic=150900.msg1132783#msg1132783

Hey John, should probably start new thread, but drawNumbers, drawText won’t compile. error message is:
TFTv2\TFTv2.cpp.o: In function ’ TFT::drawChar(unsigned char, unsigned int, unsigned int, unsigned int, unsigned int) ’ :
…\Arduino\libraries\TFTvs/TFTv2.cpp:284:undefined reference to ‘simpleFont’
…\Arduino\libraries\TFTvs/TFTv2.cpp:284:undefined reference to ‘simpleFont’

Any ideas?

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()
{

}

John, Thanks for reply.

I must apologize for the inaccuracies in my last posted question.

First, of the 9 sketches (in library examples) provided by Seeed for the 2.8 TFTV2, the drawNumber and text.ino do not compile. Initially I was using the library file TFTv2.cpp supplied by Seeed, that returned the error identified earlier with the line number 284. I realized, after careful review, that you are using the TFTv2.cpp library file you modified to rotate the text. I exchanged the two TFTv2.cpp files, hoping the two sketches would then run, but no they do not. But the line number for the error is now 356 as you noted in your post.

TFTv2\TFTv2.cpp.o: In function ’ TFT::drawChar(unsigned char, unsigned int, unsigned int, unsigned int, unsigned int) ’ :
…\Arduino\libraries\TFTvs/TFTv2.cpp:356: undefined reference to ‘simpleFont’
…\Arduino\libraries\TFTvs/TFTv2.cpp:356: undefined reference to ‘simpleFont’

I checked the text.ino sketch character by character and found no differences between the code you posted and text.ino I am using.

I am using Arduino IDE 1.0.5-r2, running on windows 7.

Now again, any ideas?

James

No apology needed - been there, done that!

First, make sure you have only one folder containing the library files, and make sure you only have one .cpp and one .h file in that folder. Take any others out of the path - stick them in an unrelated location. The Arduino is relatively clueless when there are multiple folders - or directories I guess, since you use Windows and I’m a Mac guy.

Second, if you use my modified .cpp file, you must also use the modified .h file.

Third, try an earlier version of the Arduino IDE. I’d go back to V1.03. I have read of anomalies with the later versions.

Other than that, I have nothing else to contribute. The fact that you get compile errors seems to point to an IDE problem, or perhaps a multiple library issue(s).

Regards,
John

John, Thought you might be interested in my error. Loovee responded to the thread I had started specifically for the compile error.

I had not moved all the files from the TFTv2…-master to the TFTv2 library for the IDE, leaving out the “font.c” generating the compile error “undefined reference”. Once all files were transferred, the example sketches ran without a hitch.

As I responded to Loovee, I’m learning something new everyday, with the help of knowledgeable people.

Thanks again for your assistance,
James

James,

Thanks for letting me know what the problem was; and glad you are up and running!

John

Incase you wound up here looking for the Streaming library like me it can be found in the Seeed-Studio GitHub Starter Shield repository. github.com/Seeed-Studio/Starter … /Streaming

Hi all,
I’m new in this forum.
I kindly ask you an information.
Recently i have bounght a TFT touch shield v2.0 2.8" seeedstudio.
I downloaded the library “SeeedTFTV2.0 Library for Arduino 1.0”

Inside the folder there is an exercise called “touchscreendemoshield”.
I have uploaded this demo on my Arduino and i have opened the serial monitor.

When i touch the screen i should see on serial monitor the coordinates x,y and the value of pressure.
The problem is that, wherever i touch the screen, the coordinates x,y remain unchanged.
What i have to do?

Many thanks in advance

Umberto

The touch screen is different entity then the lcd screen and the touch x,y starts at the bottom left where the lcd screen x,y start at the top left.

There are some great tutorials on youtube and here is a wiki seeedstudio.com/wiki/2.8’’_T … hield_V2.0

Tutorial
youtube.com/watch?v=UYOePvSAytA

Thank you for your answer,
I read the link you suggested:
http://www.seeedstudio.com/wiki/2.8%27%27_TFT_Touch_Shield_V2.0

I try to use the demo inside the TouchScreen Library called “touchscreendemoshield” but if i touch different part of the screen, the coordinates on serial monitor remain constant.
Instead i have to obtain the same result shown in the following link:

[youtube]https://www.youtube.com/watch?v=t5hvpoIzm8k[/youtube]

Umberto