#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#include <SPI.h>
#define TFT_CS 10
#define TFT_DC 9
#define TFT_RST -1 // RST can be tied to the Arduino RESET pin
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
void setup() {
Serial.begin(115200);
tft.begin();
tft.setRotation(3); // Adjust the rotation if needed
}
void loop() {
// Your code here
// Display filled circles and squares
displayFilledCircles();
delay(2000); // Pause for 2 seconds
tft.fillScreen(ILI9341_BLACK); // Clear the screen
displayFilledSquares();
delay(2000); // Pause for 2 seconds
tft.fillScreen(ILI9341_BLACK); // Clear the screen
}
void displayFilledCircles() {
// Display filled circles at different positions
tft.fillCircle(80, 80, 30, ILI9341_RED);
tft.fillCircle(160, 120, 20, ILI9341_GREEN);
tft.fillCircle(40, 160, 25, ILI9341_BLUE);
tft.fillCircle(210, 80, 30, ILI9341_YELLOW);
tft.fillCircle(240, 180, 20, ILI9341_WHITE);
tft.fillCircle(40, 260, 25, ILI9341_CASET);
}
void displayFilledSquares() {
// Display filled squares at different positions
tft.fillRect(40, 40, 60, 60, ILI9341_YELLOW);
tft.fillRect(120, 80, 40, 40, ILI9341_CYAN);
tft.fillRect(200, 120, 50, 50, ILI9341_MAGENTA);
tft.fillRect(240, 40, 60, 60, ILI9341_YELLOW);
tft.fillRect(0, 20, 40, 40, ILI9341_WHITE);
}