2.8" Touch Shield -- How to rotate the layout??

Hi guys,

I have just bought this amazing tft display, I have try to write some code to it and I have realised that the layout is 240x320 (portrait).
I need to use it in a 320x240 (landscape) layout, so, how can I do it??

Thank you


I added text rotation to the libraries which are available here, http://arduino.cc/forum/index.php/topic,150900.0.html, but you must have an account to access them.

If you had searched this board, you would have found the announcement.

Hi Martin,

Just one more doubt…

I am writing a code where this display is working to display some float values that are being read from an external device by the arduino board. I am printing these values into the display like this:

int motor = outputValue/10;

“motor is a 4 digit numeric value divide by 10 to have a final 3 digit value, from -100% to 100%”

This is the command amount for the motor from a motor controller

The problem is that the float value update is printing the number over the other… is not cleaning the previous value to print the new one… at one point I don’t have numbers any more, they were printed so many times that I just have a complete filled rectangle…

If I use the same code with an oled display it works correctly… like this


Is there a way to improve this?

Thank you

If your text is to be drawn at the same location each time, you can clear the previous text by redrawing that same text in the background color before drawing the new text.
If your text is drawn inside a rectangle, you can fill the rectangle with the background color, then draw your new text.
If your text is not drawn inside a rectangle, you can create a filled rectangle of the background color which overlaps the area of the drawn text.