#include <SPI.h>
#include <TFT_eSPI.h> // Hardware-specific library
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
#define bgcolor 0xF800
int x = 0;
int andar = 0;
int barX = 0; // Posição X do botão
int barY = 200; // Posição Y do botão
int barWidth = 2000; // Largura do botão
int barHeight = 500;
int num = 0;
void setup() {
tft.init();
tft.setRotation(3);
x++;
delay(100);
tft.fillScreen(bgcolor);
delay(100);
carregamento();
telaInit();
drawBar();
}
void loop() {
}
void carregamento() {
for (andar = 0; andar < 1000; andar = andar + 29) {
tft.fillCircle(andar, 16, 10, TFT_GREEN);
}
}
void telaInit() {
tft.fillScreen(TFT_BLACK);
tft.setRotation(3);
}
void drawBar() {
tft.drawRect(barX, barY, barWidth, barHeight, TFT_WHITE);
tft.fillRect(barX, barY, barWidth, barHeight, TFT_WHITE);
tft.setTextSize(2);
tft.setTextColor(TFT_BLACK);
tft.setCursor(barX + 20, barY + 15);
tft.println("Chat");
tft.setCursor(barX + 200, barY + 15);
tft.println(tempo());
}
String tempo() {
time_t mytime;
String a;
mytime = time(NULL);
struct tm tm = *localtime(&mytime);
a = ("Data: %d/%d/%d/\n", tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900);
return a;
}