#include <TFT_eSPI.h> // Include the TFT_eSPI library
// Define the display size (replace with your display's width and height)
#define LCD_WIDTH 320
#define LCD_HEIGHT 240
// Define some colors
#define WHITE 0xFFFFFF
#define BLACK 0x000000
#define RED 0xFFFF00
#define GREEN 0x00FF00
#define BLUE 0x0000FF
// Create an instance of the TFT display library
TFT_eSPI lcd = TFT_eSPI();
// int textWidth = lcd.textWidth("lcd");
void setup() {
// Initialize the display
lcd.init();
lcd.setRotation(0);
// Fill the screen with a black background
lcd.fillScreen(BLACK);
// Draw some text
lcd.setTextColor(WHITE);
lcd.setTextSize(2);
lcd.setCursor(10, 10);
lcd.println("LED Display");
// Draw a rectangle
lcd.drawRect(10, 50, 100, 50, WHITE);
lcd.setTextColor(WHITE);
lcd.setTextSize(2);
lcd.setCursor(40, 70);
lcd.println("LED");
// Draw a circle
lcd.fillCircle(150, 70, 20, GREEN);
lcd.setTextColor(WHITE);
lcd.setTextSize(2);
lcd.setCursor(140, 65);
lcd.println("ON");
lcd.fillCircle(200, 70, 20, GREEN);
lcd.setTextColor(WHITE);
lcd.setTextSize(2);
lcd.setCursor(190, 65);
lcd.println("OFF");
// Draw a line
// lcd.drawLine(10, 110, 100, 160, GREEN);
// Draw a rectangle
lcd.drawRect(10, 150, 100, 50, WHITE);
lcd.setTextColor(WHITE);
lcd.setTextSize(2);
lcd.setCursor(35, 165);
lcd.println("Blink");
// Draw a rectangle
lcd.drawRect(10, 250, 100, 50, WHITE);
lcd.setTextColor(WHITE);
lcd.setTextSize(2);
lcd.setCursor(35, 265);
lcd.println("Servo");
}
void loop() {
// You can add code here to update the display in your main loop
}