/*
ESP32 HTTPClient Jokes API Example
https://wokwi.com/projects/342032431249883731
Copyright (C) 2022, Uri Shaked
*/
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#include "Point.h"
#define SIZE 40
#define TFT_DC 2
#define TFT_CS 15
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
void setup() {
tft.begin();
tft.setRotation(1);
tft.setTextColor(ILI9341_WHITE);
tft.setTextSize(2);
}
void draw_point(Point& pp1,Point& pp2){
tft.drawLine(pp1.get_x(),pp1.get_y(),pp2.get_x(),pp2.get_y(),ILI9341_WHITE);
}
void loop() {
tft.fillScreen(ILI9341_BLACK);
tft.setCursor(0,0);
tft.print("Welcome to Drawing on TFT");
int x=tft.width()/2;
int y=tft.height()/2;
Point p1;
Point p2;
Point p3;
Point p4;
p1.set_x(x);
p1.set_y(y);
p2.set_x(x);
p2.set_y(y+(SIZE+SIZE+SIZE));
p3.set_x(x+(SIZE+SIZE+SIZE));
p3.set_y(y+(SIZE+SIZE+SIZE));
p4.set_x(x+(SIZE+SIZE+SIZE));
p4.set_y(y);
draw_point(p1,p2);
draw_point(p2,p3);
draw_point(p3,p4);
draw_point(p4,p1);
delay(1000);
}