/*
  ESP32 HTTPClient Jokes API Example

  https://wokwi.com/projects/342032431249883731

  Copyright (C) 2022, Uri Shaked
*/
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#include <list>
#define TFT_DC 2
#define TFT_CS 15
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
class Point {
public:
  int x;
  int y;
  Point(int x_0, int y_0) : x(x_0), y(y_0) {}
};
std::list<Point> points;
void setup() {
  tft.begin();
  points.push_back(Point(0, 0));
  points.push_back(Point(40, 40));
  points.push_back(Point(60, 60));
  points.push_back(Point(80, 80));
  points.push_back(Point(100, 100));
  points.push_back(Point(120, 120));
  points.push_back(Point(140, 140));
  points.push_back(Point(160, 160));
  points.push_back(Point(180, 180));
  points.push_back(Point(200, 200));
}
void loop() {
  tft.fillScreen(ILI9341_BLACK);
  std::list<Point>::iterator iter = points.begin();
  std::advance(iter, 1);  
  while (iter != points.end()) {
    tft.drawLine(points.front().x, points.front().y, iter->x, iter->y, ILI9341_ORANGE);
    delay(1000);
    iter++;
  }
}