Lavanya rajan
Well-known member
Hello All,
I'm trying to interface a 2.4" TFT SPI 240x320 display with a Teensy 4.0 microcontroller. The pin connections follow the setup described in the link below, except that the CS (Chip Select) pin is connected to pin 9, and the DC (Data/Command) pin is connected to pin 10.
www.pjrc.com
I'm using the following code, but the text on the display appears mirrored, even though the rotation is set correctly and also The background color isn't displaying properly — I'm using fillScreen(RED), but the screen shows blue instead.. Can anyone help me figure out what's causing this and how to fix it?
I'm trying to interface a 2.4" TFT SPI 240x320 display with a Teensy 4.0 microcontroller. The pin connections follow the setup described in the link below, except that the CS (Chip Select) pin is connected to pin 9, and the DC (Data/Command) pin is connected to pin 10.
PJRC Store
I'm using the following code, but the text on the display appears mirrored, even though the rotation is set correctly and also The background color isn't displaying properly — I'm using fillScreen(RED), but the screen shows blue instead.. Can anyone help me figure out what's causing this and how to fix it?
Code:
#include <SPI.h>
#include <Wire.h>
#include <ILI9341_t3.h>
// Define pins for the TFT display
#define TFT_CS 9
#define TFT_DC 10
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);
void setup(void) {
Serial.begin(9600);
tft.begin();
// Try different values (0 to 3) if needed: 0 = portrait, 1 = landscape, 2 = upside down, 3 = other landscape
tft.setRotation(1); // Usually best for non-mirrored portrait
tft.fillScreen(ILI9341_RED); // Set background to blue
// Optional: disable text wrapping
tft.setTextWrap(false);
// Set text properties
tft.setTextColor(ILI9341_WHITE); // Text color
tft.setTextSize(2); // Text size
tft.setCursor(30, 30); // Adjust position
// Display the message
tft.println("Hello World!!!");
}
void loop() {
// Nothing to do here
}