Hello,
I have a quick question: how do you rotate text on a tft display with adafruit gfx? does anyone know?
Yes, consult the library documentation for screen orientation commands.
Mr Google knows how to do it
I am surprised that you didn't find it when you searched
I did, but when I tried it it didn't rotate anything
I cannot see anything wrong with the code that you did not post
true.
#include "Adafruit_GFX.h"
#include "MCUFRIEND_kbv.h"
MCUFRIEND_kbv tft(A3, A2, A1, A0, A4);
#define BLACK 0x0000
#define NAVY 0x000F
#define DARKGREEN 0x03E0
#define DARKCYAN 0x03EF
#define MAROON 0x7800
#define PURPLE 0x780F
#define OLIVE 0x7BE0
#define LIGHTGREY 0xC618
#define DARKGREY 0x7BEF
#define BLUE 0x001F
#define GREEN 0x07E0
#define CYAN 0x07FF
#define RED 0xF800
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#define ORANGE 0xFD20
#define GREENYELLOW 0xAFE5
#define PINK 0xF81F
void setup() {
uint16_t ID = tft.readID();
tft.begin(ID);
tft.width();
tft.height();
tft.fillScreen(CYAN);
}
void loop() {
tft.setRotation(0);
tft.fillScreen(CYAN);
delay(500);
tft.fillRect(1, 1, 20, 319, GREEN);
delay(500);
tft.fillRect(22, 200, 100, 15, OLIVE);
delay(500);
tft.fillCircle(173, 207, 50, GREEN);
delay(500);
tft.fillRect(20, 40, 50, 8, GREEN);
delay(500);
tft.fillCircle(90, 43, 20, PINK);
delay(500);
tft.fillCircle(90, 43, 5, BLACK);
delay(1000);
tft.fillCircle(90, 43, 5, BLACK);
delay(1000);
tft.fillCircle(90, 43, 5, BLACK);
delay(1000);
tft.fillCircle(90, 43, 5, BLACK);
delay(1000);
tft.fillCircle(90, 43, 5, BLACK);
delay(1000);
tft.fillCircle(90, 43, 5, BLACK);
delay(10000);
tft.fillRect(1,1,240,320,BLACK);
tft.setRotation(90);
delay(500);
tft.println("Happy spring!");
delay(10000);
}
(my replies are delayed because I dont have more the 100 posts)
Put tft.setRotation(0); in setup() for one.. Then try tft.setRotation(1); To see if it's different.
-jim lee
will do
Update: Thank you so much! that actually did exactly what I wanted it to!
Cool! You're very welcome!
-jim lee
new question: is there anyway to clear the display? (besides tft.fillRect and tft.fillScreen)
Well think about that. What would "clear" actually be?
-jim lee
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.