/***************************************************
This is our GFX example for the Adafruit ILI9341 Breakout and Shield
----> http://www.adafruit.com/products/1651
*/
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include <vector>
// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10
// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
class line {
int x0,x1,y0,y1;
std::String col;
public:
line(int A0, int A1, int C0, int C1, std::String color):x0(A0),x1(x1),y0(C0),y1(C1),col(color)
{}
void draw(){
tft.drawLine(x0,x1,y0,y1,col);
}
void display()
{
}
};
void setup() {
Serial.begin(9600);
Serial.println("Welcome to C++ Learning");
tft.begin();
}
void loop(void) {
std::vector<line> l1;
l1.push_back(line(10, 10, 40, 40,ILI9341_YELLOW));
l1.draw();
l1.push_back(line(40, 40, 10, 80,ILI9341_YELLOW));
l1.draw();
l1.push_back(line(10, 80, 40, 40,ILI9341_YELLOW));
l1.draw();
l1.push_back(line(40, 40, 10, 80,ILI9341_YELLOW));
l1.draw();
delay(1000);
}
// unsigned long line10(uint16_t color) {
// unsigned long start;
// tft.fillScreen(ILI9341_BLACK);
// std::vector<int> line;
// tft.drawLine(10, 10, 40, 40,color);
// tft.drawLine(40, 40, 10, 80,color);
// return micros() - start;
// }