#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#include <vector>
class Point {
public:
int x, y;
Point(int xCoord, int yCoord) : x(xCoord), y(yCoord) {}
};
#define TFT_DC 2
#define TFT_CS 15
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
std::vector<Point> points = { Point(10, 20),Point(20, 30), Point(30, 40),
Point(40, 50), Point(50, 60), Point(60, 70),
Point(70, 80), Point(80, 90), Point(90, 100),
Point(100, 100)};
void setup() {
tft.begin();
}
void loop() {
int cx = tft.width() / 2;
int cy = tft.height() / 2;
tft.fillScreen(ILI9341_BLACK);
int startX = cx;
int startY = cy;
for (const Point &p : points) {
int endX = cx + p.x;
int endY = cy + p.y;
tft.drawLine(startX, startY, endX, endY, ILI9341_GREEN);
startX = endX;
startY = endY;
}
delay(1000);
}