//#include "SPI.h"
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#define TFT_DC 9
#define TFT_CS 10
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
unsigned long tim1, tim2;
byte n;
byte h, m, s;
void setup()
{
//tft.reset();
tft.begin(0x9341);
tft.setRotation(0);
tft.fillScreen(ILI9341_BLACK);
tft.setCursor(25,60);
tft.setTextSize(3);
tft.setTextColor(ILI9341_RED);
tft.setTextColor(ILI9341_RED, ILI9341_BLACK);
tft.print("TFT Display");
tft.setCursor(15,110);
tft.setTextSize(3);
tft.setTextColor(ILI9341_CYAN);
tft.setTextColor(ILI9341_CYAN, ILI9341_BLACK);
tft.println("CHETIK-BPEMA");
}
void loop()
{
tft.setCursor(50,160);
tft.setTextSize(6);
tft.setTextColor(ILI9341_GREEN);
tft.setTextColor(ILI9341_GREEN, ILI9341_BLACK);
tft.print((n/1000)%10);
tft.print((n/100)%10);
tft.print((n/10)%10);
tft.print(n%10);
if(millis()-tim1>200)
{
tim1=millis();
n++;
if(n>9999) { n=0; }
}
//========================
tft.setCursor(20,220);
tft.setTextSize(4);
tft.setTextColor(ILI9341_GREEN);
tft.setTextColor(ILI9341_GREEN, ILI9341_BLACK);
tft.print((h/10)%10);
tft.print(h%10);
tft.print(":");
tft.print((m/10)%10);
tft.print(m%10);
tft.print(":");
tft.print((s/10)%10);
tft.print(s%10);
if(millis()-tim2>50)
{
tim2=millis();
s++;
if(s>59) { s=0; m++; }
if(m>59) { m=0; h++; }
if(h>23) { h=0; }
}
}