Hello all, I cannot seem to get my screen to rotate when displaying text on the screen. I'm using an Arduino Uno, RA8875 driver board, and the Adafruit 5.0" TFT screen. Here is my code....
No matter what value I put in the tft.setRotation() statement (0, 1, 2, 3), the text is always displayed in landscape mode (horizontally). I need to be able to turn my screen vertically (portrait mode), and have the text displayed properly.
I've tried the tft.setRotation() command in both the Setup() and Loop() portions of the sketch. Nothing changes no matter where I place it and no matter what value I use.
#include <SPI.h>
#include "Adafruit_GFX.h"
#include "Adafruit_RA8875.h"
// Library only supports hardware SPI at this time
// Connect SCLK to UNO Digital #13 (Hardware SPI clock)
// Connect MISO to UNO Digital #12 (Hardware SPI MISO)
// Connect MOSI to UNO Digital #11 (Hardware SPI MOSI)
#define RA8875_INT 3
#define RA8875_CS 10
#define RA8875_RESET 9
Adafruit_RA8875 tft = Adafruit_RA8875(RA8875_CS, RA8875_RESET);
uint16_t tx, ty;
void setup()
{
Serial.begin(9600);
Serial.println("RA8875 start");
/* Initialize the display using 'RA8875_480x80', 'RA8875_480x128', 'RA8875_480x272' or 'RA8875_800x480' */
if (!tft.begin(RA8875_800x480 )) {
Serial.println("RA8875 Not Found!");
while (1);
}
tft.displayOn(true);
tft.GPIOX(true); // Enable TFT - display enable tied to GPIOX
tft.PWM1config(true, RA8875_PWM_CLK_DIV1024); // PWM output for backlight
tft.PWM1out(255);
tft.setRotation(1); //0 = no rotation, 1 = 90 degrees, 2 = 180 degrees, 3 = 270 degrees
}
void loop()
{
/* Switch to text mode */
tft.fillScreen(RA8875_BLACK);
tft.textMode();
tft.cursorBlink(32);
/* Set the cursor location (in pixels) */
tft.textSetCursor(10, 10);
/* Render some text! */
tft.textTransparent(RA8875_WHITE);
tft.textWrite("HELLO WORLD");
delay(40000);
}
setRotation() using RA8875 and 5.0" TFT
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- mikeysklar
- Posts: 13936
- Joined: Mon Aug 01, 2016 8:10 pm
Re: setRotation() using RA8875 and 5.0" TFT
I see *some* support being added in April 2019.
https://github.com/adafruit/Adafruit_RA8875/issues/19
Do you see any effect with (flip screen):
https://github.com/adafruit/Adafruit_RA8875/pull/12
https://github.com/adafruit/Adafruit_RA8875/issues/19
Do you see any effect with (flip screen):
Code: Select all
tft.setrotation(2);
Please be positive and constructive with your questions and comments.