// #include "SPI.h"
// #include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
// #define TFT_DC 9
// #define TFT_CS 10
#define TFT_MISO 19
#define TFT_SCK 18
#define TFT_MOSI 23
// #define TFT_
#define TFT_DC 4
#define TFT_CS 15
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// uint16_t blockColors[] = {
// RGB_COLOR16(0,0,255),
// RGB_COLOR16(255,96,0),
// RGB_COLOR16(255,255,192),
// RGB_COLOR16(255,255,255),
// RGB_COLOR16(255,255,64),
// RGB_COLOR16(128,128,128),
// };
uint16_t blockColorss[] = {
tft.color565(255,0,0),
tft.color565(0,255,0),
tft.color565(0,0,255),
tft.color565(255,255,0),
tft.color565(255,0,255),
tft.color565(0,255,255)
};
#define CLR_BLACK 0x0000
#define CLR_BLUE 0x001F
#define CLR_RED 0xF800
#define CLR_GREEN 0x07E0
#define CLR_CYAN 0x07FF
#define CLR_MAGENTA 0xF81F
#define CLR_YELLOW 0xFFE0
#define CLR_WHITE 0xFFFF
uint16_t FCLR_red = tft.color565(255, 0, 0);
uint16_t FCLR_green = tft.color565(0, 255, 0);
uint16_t FCLR_blue = tft.color565(0, 0, 255);
uint16_t FCLR_yellow = tft.color565(255, 255, 0);
void ClrWrte(){
// tft.setCursor(0, 0);
// tft.setTextColor(ILI9341_RED);
// tft.setTextColor(ILI9341_GREEN);
tft.setCursor(0, 0);
// tft.setTextColor(CLR_RED);
// tft.setTextColor(tft.color565(0, 0, 255));
tft.setTextColor(blockColorss[3]);
tft.setTextSize(1);
tft.println("1234567890123456789012345678901234567890");
tft.setCursor(0, 10);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(1);
tft.println("2345678901234567890123456789012345678901");
// Serial.print("\" ");
// Serial.print();
// Serial.print("\" ");
// Serial.println("\"");
Serial.println("ILI9341_GREEN \t: \"" + String(ILI9341_GREEN) + "\"");
Serial.println("FCLR_green \t: \"" + String(FCLR_green) + "\"");
// Serial.println("ILI9341_GREEN : \"" + String(ILI9341_GREEN) + "\"");
// Serial.println("ILI9341_GREEN : \"" + String(ILI9341_GREEN) + "\"");
}
void ClrWrt(){
int Lmt = ((sizeof(blockColorss) / sizeof(blockColorss[0])));
int Lms = Lmt - 1;
int c = 0;
for (int a = 0; a < 50; a++) {
int b = a * 10;
c = ((c == Lms)?0:c);
int d = c;
uint16_t e = blockColorss[d];
int f = a + 1;
String g = ((f<=9)?"0"+String(f):String(f));
tft.setCursor(0, b);
tft.setTextColor(e);
tft.setTextSize(1);
tft.println(g);
Serial.println("Line " + String(g));
c++;
delay(100);
}
Serial.println("complete");
}
void CntVert() {
// tft.setCursor(26, 120);
tft.setCursor(0, 0);
tft.setTextColor(ILI9341_RED);
// tft.setTextColor(ILI9341_GREEN);
// tft.setTextSize(3);
// tft.println("Hello, TFT!");
// tft.println("Holla");
tft.setTextSize(1);
tft.println("1234567890");
tft.setCursor(0, 10);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(1);
tft.println("23456789012345678901");
tft.setCursor(0, 20);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(1);
tft.println("345678901234567890123456789012");
tft.setCursor(0, 30);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(1);
tft.println("4567890123456789012345678901234567890123");
tft.setCursor(0, 40);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(1);
tft.println("5678901234567890123456789012345678901234");
tft.setCursor(0, 50);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(1);
tft.println("6789012345678901234567890123456789012345");
tft.setCursor(0, 60);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(1);
tft.println("7890123456789012345678901234567890123456");
tft.setCursor(0, 70);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(1);
tft.println("6789012345678901234567890123456789012345");
tft.setCursor(0, 80);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(1);
tft.println("7890123456789012345678901234567890123456");
// tft.setCursor(20, 160);
// tft.setTextColor(ILI9341_GREEN);
// tft.setTextSize(2);
// tft.println("ESP32");
// tft.println("I can has colors?");
// tft.setTextColor(ILI9341);
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
tft.begin();
delay(1000);
ClrWrt();
}
void loop() {
// put your main code here, to run repeatedly:
// delay(10); // this speeds up the simulation
}