#include < lvgl.h >
#include < TFT_eSPI.h >
#include < SPI.h >
#include < SD.h >
// Define the shared SPI pins for all TFT screens
#define TFT_SPI_CLK 18
#define TFT_SPI_MOSI 23
#define TFT_SPI_MISO 19
// Define the individual CS pins for each TFT screen
#define TFT_CS1 5
#define TFT_CS2 16
#define TFT_CS3 17
// Define the individual DC pins for each TFT screen
#define TFT_DC1 15
#define TFT_DC2 14
#define TFT_DC3 13
// Define the SD card pins
#define SD_CS 2
chuchin
copilot
-
Shared SPI Pins:
- CLK (Clock): Connect U1:U1:D18 to the CLK pin of all three TFT displays.
- MOSI (Master Out Slave In): Connect U1:U1:D23 to the MOSI pin of all three TFT displays.
- MISO (Master In Slave Out): Connect U1:U1:D19 to the MISO pin of all three TFT displays.
-
TFT Display 1:
- CS (Chip Select): Connect U1:U1:D5 (TFT_CS1) to the CS pin of TFT display 1.
- DC (Data/Command): Connect U1:U1:D15 (TFT_DC1) to the DC pin of TFT display 1.
-
TFT Display 2:
- CS (Chip Select): Connect U1:U1:D16 (TFT_CS2) to the CS pin of TFT display 2.
- DC (Data/Command): Connect U1:U1:D14 (TFT_DC2) to the DC pin of TFT display 2.
-
TFT Display 3:
- CS (Chip Select): Connect U1:U1:D17 (TFT_CS3) to the CS pin of TFT display 3.
- DC (Data/Command): Connect U1:U1:D13 (TFT_DC3) to the DC pin of TFT display 3.
-
SD Card Module:
- CS (Chip Select): Connect U1:U1:D2 (SD_CS) to the CS pin of the SD card module.
-
Power Supply:
- 3.3V Power: Connect U1:3V3 to the VCC (or 3.3V) pin of all TFT displays and the SD card module.
- Ground: Connect U1:GND to the GND pin of all TFT displays and the SD card module.
Summary of Connections:- Connect U1:U1:D18 to CLK pin of all TFT displays.
- Connect U1:U1:D23 to MOSI pin of all TFT displays.
- Connect U1:U1:D19 to MISO pin of all TFT displays.
- Connect U1:U1:D5 to CS pin of TFT display 1.
- Connect U1:U1:D15 to DC pin of TFT display 1.
- Connect U1:U1:D16 to CS pin of TFT display 2.
- Connect U1:U1:D14 to DC pin of TFT display 2.
- Connect U1:U1:D17 to CS pin of TFT display 3.
- Connect U1:U1:D13 to DC pin of TFT display 3.
- Connect U1:U1:D2 to CS pin of SD card module.
- Connect U1:3V3 to VCC pins of all components.
- Connect U1:GND to GND pins of all components.
Implementation in Flux:chuchin
copilot
- Conectar U1:U1:D18 al pin CLK de todas las pantallas TFT.
- Conectar U1:U1:D23 al pin MOSI de todas las pantallas TFT.
- Conectar U1:U1:D19 al pin MISO de todas las pantallas TFT.
Pantalla TFT 1:- Conectar U1:U1:D5 (TFT_CS1) al pin CS de la pantalla TFT 1.
- Conectar U1:U1:D15 (TFT_DC1) al pin DC de la pantalla TFT 1.
Pantalla TFT 2:- Conectar U1:U1:D16 (TFT_CS2) al pin CS de la pantalla TFT 2.
- Conectar U1:U1:D14 (TFT_DC2) al pin DC de la pantalla TFT 2.
Pantalla TFT 3:- Conectar U1:U1:D17 (TFT_CS3) al pin CS de la pantalla TFT 3.
- Conectar U1:U1:D13 (TFT_DC3) al pin DC de la pantalla TFT 3.
Módulo de Tarjeta SD:- Conectar U1:U1:D2 (SD_CS) al pin CS del módulo de tarjeta SD.
Fuente de Alimentación:- Conectar U1:3V3 al pin VCC de todas las componentes.
- Conectar U1:GND al pin GND de todas las componentes.
Implementación en Fluxchuchin
copilot
-
Instalar el Soporte para ESP32 en Arduino IDE:
- Abre el Arduino IDE.
- Ve a
- En el campo
- Abre el
- Busca “ESP32” e instala el paquete
-
Seleccionar la Placa y el Puerto:
- Ve a
- Ve a
Cargar el Código:File>Preferences.Additional Board Manager URLs, agregahttps://dl.espressif.com/dl/package_esp32_index.json.Boards ManagerdesdeTools>Board>Boards Manager.esp32porEspressif Systems.Tools>Board, seleccionaESP32 Dev Module.Tools>Porty selecciona el puerto correspondiente a tu ESP32.- Abre el Arduino IDE.
- Copia y pega el código anteriormente proporcionado en un nuevo sketch.
- Guarda el sketch.
- Conecta el ESP32 a tu computadora mediante un cable USB.
- Haz clic en el botón
3. Conexiones en tu Diagrama en FluxUploaden la esquina superior izquierda del Arduino IDE para cargar el código en el ESP32.-
Documentar el Código:
- Es una buena práctica incluir tu código como un archivo adjunto o comentario en tu proyecto Flux para mantener todo bien documentado.
-
Adjuntar el Código al ESP32:
- En el diagrama de Flux, selecciona el ESP32 (U1) y agrega una opción o comentario que indique que este componente utiliza el código. No es necesario cargar el código directamente a través de Flux, pero puedes incluir un enlace o nombre del archivo de tu sketch.
Ensamblar y Probar: