Go Down

Topic: SeeedStudio TFT V2.0 text direction added (Read 22392 times) previous topic - next topic

-__-

Feb 25, 2013, 10:48 pm Last Edit: May 11, 2014, 12:05 am by -__- Reason: 1
Hello all,
I have added code to allow for text direction on the V2.0 LCD shield from SeeedStudios.
I tried to upload the code at Seeed's forum but although the progress box indicated the files were uploaded, I have no idea where, so I'm putting them here.

The modified .cpp and .h files were tested on one of my sketches and also with the V1.0 example, text4Directions.  Both sketches work fine. For the example, change the #include statement from <TFT.h> to <TFTv2.h>, and add #include <SPI.h>.  I also commented out the TouchScreen  #include as it isn't used in this sketch. Finally, in void setup(), change from Tft.init; to Tft.TFTinit();.

I've also made a change to the color definitions, changing BRIGHT_RED to PINK, and adding DARK_GREEN and MAGENTA.

Regards,
-__-


xrail

Great improvement.. Thank you... be able to rotate the text is a "must have"..

Just one more question...

How can I generate the color "Orange" ????

I have tried to use HEX codes for orange from the net, like the html ones but none is working..
The color has to be created in the library?

Thank you

Regards

-__-

New color definitions are defined in the header file, TFTv2.h.  Unless you have a utility to convert a color from a chart, for example, to a HEX value, you'll have to try various values until you get what you want.

Add your new color to the KEYWORDS text file if you want the name of your new color highlighted in the IDE.  The color will still be recognized by the compiler if you don't add it to the KEYWORDS file though. If you decide to add your new color to KEYWORDS, make sure you have the name of the color tabbed correctly else the IDE will not highlight it in your code.

-__-

xrail

#3
Mar 27, 2013, 05:29 pm Last Edit: Mar 27, 2013, 05:43 pm by xrail Reason: 1
Understood!!

Last thing...  do you have an exemple code on how to use the new text rotation function?

Tft.setOrientation(???????);


Cheers

-__-

Download the Version 1.0 files from: http://www.seeedstudio.com/wiki/File:TFT_Touch_Shield_libraries.zip.

Open the examples folder and open text4Directions.ino. You'll have to change the #include statements as indicated in the first post in this thread.

The text4Directions.ino sketch will show the directions syntax.

-__-

AffordableTechnology


Hello all,
I have added code to allow for text direction on the V2.0 LCD shield from SeeedStudios.
I tried to upload the code at Seeed's forum but although the progress box indicated the files were uploaded, I have no idea where, so I'm putting them here.


Hi,

My thanks to John Martin for posting these mods - You saved my bacon!

For the record: I have found SeeedStudio to be excellent, but releasing a "new, greatly improved version" of their TFT display which is in fact a backward step, was very disappointing!  I had purchased two Ver1 displays for prototypes and testing, then decided to go with the "better" Ver 2 display in the finished project.  To my horror it could not run my software and I am due to deliver in a couple days.

:0At the very least, SeeedStudio should point out clearly in their product info that the "new improved" version lacks significant features found in the older product. - Shame on you SeeedStudio!

Regards,

Paul

-__-




For the record: I have found SeeedStudio to be excellent, but releasing a "new, greatly improved version" of their TFT display which is in fact a backward step, was very disappointing!  I had purchased two Ver1 displays for prototypes and testing, then decided to go with the "better" Ver 2 display in the finished project.  To my horror it could not run my software and I am due to deliver in a couple days.

:0At the very least, SeeedStudio should point out clearly in their product info that the "new improved" version lacks significant features found in the older product. - Shame on you SeeedStudio!

Regards,

Paul



Paul,
Glad you were able to use my updates to Seeed's V2 TFT display.  I too was exceedingly disappointed at finding the libraries to be lacking text rotation. Not being a software guy, I figured I'd bug Seeed about it but after no urgency on their part I decided to have a go at it.  It actually turned out to be reasonably easy as the different controller apparently used the same address/data format as the V1 device.
Best regards, John

-__-

vocho


-__-


vocho

Sorry, I try to put only Tft.setOrientation (1), in my arduino code but nothing happened to me, I'm new to this and hope you can help me. Nose as properly be put, I am using an arduino mega. regards

-__-

Vocho,
1. Post your code.
2. Are you using the V1 LCD shield or the V2 shield?
3. Tft.setOrientation is not a sketch command; it is a library command. The sketch command for directions is: Tft.setDisplayDirect(Down2Up) for example.
The version 1 example sketch, text4Directions.ino, shows the syntax to be used for direction.

-__-

vocho

I am new to C, I hope I can help, good with regard to this I have taken another major problem that the rotation of the screen, I try to make a clock using DS1307 RTC with TINY, however does not show me the right way numbers, ie 1,2,3 but prints all over the account if done right of 0-59 but not let me see the numbers because they never clean the previous issue, I attached a picture, hoping you can help me I thank you in advance for the attention paid,

Code: [Select]
#include <stdint.h>
#include <SeeedTouchScreen.h>
#include <TFTv2.h>
#include <SPI.h>
#include <Wire.h> // specify use of Wire.h library.

// De Decimal a BCD
byte decToBcd(byte val){
  return ( (val/10*16) + (val%10) );
};

// De BCD a Decimal
byte bcdToDec(byte val){
  return ( (val/16*10) + (val%16) );
};
/*************************************/

/********** Variables Reloj **********/

byte seconds = 0;
byte minutes = 0;
byte hours = 0;
byte day = 0;
byte date = 0; //dia
byte month = 0;
byte year = 0;

int fecha=0;
char buufer[12];


unsigned long tiempo_s1, tiempo_s2=0, retardo_s1=50;

TouchScreen ts = TouchScreen(XP, YP, XM, YM); //init TouchScreen port pins

void setup()
{


   TFT_BL_ON;                                          //turn on the background light
   Tft.TFTinit();
   Wire.begin();
   
   
   Tft.fillCircle(40, 160, 30,BLUE); // (x,y, radio, color) BOTON 1
   Tft.drawString("AA", 18, 145, 3, WHITE);     //  'S', (X, Y), Tamño: 1, color: RED 

   Tft.fillCircle(120, 160, 30, BLUE); // (x,y, radio, color) BOTON 2
   Tft.drawString("B", 110, 145, 3, WHITE);     //  'S', (X, Y), Tamño: 1, color: RED 
   
   Tft.fillCircle(200, 160, 30, BLUE); // (x,y, radio, color) BOTON 3
   Tft.drawString("CC", 180, 145, 3, WHITE);     //  'S', (X, Y), Tamño: 1, color: RED 
   
   //Tft.setOrientation(1) // ==> If I modify this parameter 1-2 should rotate the screen to landscape mode?.
                            // Try to do a small clock, setDisplayDirect command only rotating characters?
 
}
void loop()
{
   

  Wire.beginTransmission(0x68);
  Wire.write(0x00);
  Wire.endTransmission();
  Wire.requestFrom(0x68, 7);
  seconds = bcdToDec( Wire.read());
  minutes = bcdToDec( Wire.read());
  hours = bcdToDec( Wire.read());
  day = bcdToDec( Wire.read());
  date = bcdToDec( Wire.read());
  month = bcdToDec( Wire.read());
  year = bcdToDec( Wire.read());

 

Tft.drawNumber(seconds, 157, 45,  4, WHITE);

Tft.drawNumber(minutes, 105,  45,  3, WHITE);
Tft.drawString(";"    , 141, 42,  3, WHITE);

Tft.drawString("/"    , 71,  82,  3, WHITE);
Tft.drawNumber(month  , 88,  85,  3, WHITE); //(x,y)

Tft.drawNumber(date  , 33,  85,  3, WHITE); //(x,y)
Tft.drawString("/"    , 126,  82,  3, WHITE);

fecha=year+2000;
Tft.drawNumber(fecha  , 144,  85,  3, WHITE); //(x,y)
     
     
}



JohnPijnappel

Hello,
About the setOrientation() command.
I installed the new libraries and the new commands for triangle and magenta worked fine (commands turned red). Congratulations !
So the files are installed well and are implemented well. The code compiles well and uploads well.
But setOrientation doesn't function. (The word is still black, doesn't turn red: so, not recognized.)
The orientation of the display doesn't change either (not for (0), (1) or (2).
The text stays in  the same portrait orientation.
The comment about text4directions only flips characters vertical or horizontal. It doesn't rotate the text nor the entire
orientation 90 degrees.
Do you know what's wrong.

-__-


Hello,
About the setOrientation() command.
I installed the new libraries and the new commands for triangle and magenta worked fine (commands turned red). Congratulations !
So the files are installed well and are implemented well. The code compiles well and uploads well.
But setOrientation doesn't function. (The word is still black, doesn't turn red: so, not recognized.)
The orientation of the display doesn't change either (not for (0), (1) or (2).
The text stays in  the same portrait orientation.
The comment about text4directions only flips characters vertical or horizontal. It doesn't rotate the text nor the entire
orientation 90 degrees.
Do you know what's wrong.


setOrientation is NOT a sketch command. It will NOT be recognized when you compile your code.

I'm not sure what text4directions comments you refer to (it's late, here), but to change screen orientation, and thus text direction, you must use:
Tft.setDisplayDirect(XXXXXX); where XXXXXX is LEFT2RIGHT, RIGHT2LEFT, DOWN2UP, or UP2DOWN, in your code (sketch).

Regards,
-__-

JohnPijnappel

The comments you make with setDysplayDirect:  the words left2right and right2left and down2up or up2down suggests that it flips in a vertical or horizontal way, and that's not the same as rotating from portrait to landscape.

Go Up