#include <TFT_eSPI.h> // Library for TFT screens (make sure your TFT_eSPI setup is correct)
// Create instances of TFT_eSPI for each display
TFT_eSPI tft1 = TFT_eSPI();
// Define CS and DC pins for each display
#define CS1 20
#define DC1 15
// Define the RESET pin (shared)
#define RST_PIN 5
void setup() {
// Initialize serial for debugging
Serial.begin(9600);
// Set up CS and DC pins for each display
pinMode(CS1, OUTPUT);
pinMode(DC1, OUTPUT);
// Set up shared RESET pin
pinMode(RST_PIN, OUTPUT);
digitalWrite(RST_PIN, HIGH); // Keep RESET high (inactive)
// Initialize each display with a different background color
initDisplay(tft1, CS1, DC1, TFT_RED); // Display 1 with red background
}
void loop() {
// No loop behavior in this example, just initialization
}
// Function to initialize each display
void initDisplay(TFT_eSPI &tft, int csPin, int dcPin, uint16_t bgColor) {
// Set the CS and DC pins for the current display
// tft.setCsPin(csPin);
// tft.setDcPin(dcPin);
// Initialize the display
tft.init();
// Set rotation, if necessary
tft.setRotation(1); // Optional, depending on your layout
// Fill the screen with the specified background color
tft.fillScreen(bgColor);
}
Loading
esp32-s3-devkitc-1
esp32-s3-devkitc-1