#include <Arduino.h>
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>
#define TFT_CS 10
#define TFT_RST 9
#define TFT_DC 8
#define TFT_WIDTH 240
#define TFT_HEIGHT 240
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
#define BLACK 0x0000
#define WHITE 0xFFFF
#define RED 0xF800
#define GREEN 0x07E0
#define BLUE 0x001F
#define YELLOW 0xFFE0
void setup() {
Serial.begin(9600);
tft.init(TFT_WIDTH, TFT_HEIGHT);
tft.setRotation(1);
tft.fillScreen(BLACK); // Clear the screen
// Draw a rectangle
tft.drawRect(20, 20, 200, 200, GREEN);
// Draw a filled circle
tft.fillCircle(120, 120, 50, RED);
// Draw a triangle
tft.drawTriangle(50, 150, 100, 50, 150, 150, GREEN);
// Set text properties
tft.setTextSize(2);
tft.setTextColor(YELLOW);
// Print text
tft.setCursor(80, 100);
tft.println("Hello World!");
tft.setCursor(30, 165);
tft.setTextColor(RED);
tft.println("by arvind 8/7/24 !");
tft.setCursor(20, 190);
tft.setTextColor(WHITE);
tft.println("Have a nice day!");
}
void loop() {
// Your code here
}