You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.3 KiB
57 lines
1.3 KiB
#include "TFT_eSPI.h"
|
|
|
|
int X_MAX = 320;
|
|
int Y_MAX = 240;
|
|
TFT_eSPI tft;
|
|
int y = Y_MAX/5;
|
|
|
|
unsigned long myTimeInSec;
|
|
unsigned long myTimeInMin;
|
|
unsigned long hour;
|
|
|
|
|
|
void setup() {
|
|
// put your setup code here, to run once:
|
|
Serial.begin(115200);
|
|
pinMode(WIO_5S_UP, INPUT_PULLUP);
|
|
pinMode(WIO_5S_DOWN, INPUT_PULLUP);
|
|
pinMode(WIO_5S_LEFT, INPUT_PULLUP);
|
|
pinMode(WIO_5S_RIGHT, INPUT_PULLUP);
|
|
pinMode(WIO_5S_PRESS, INPUT_PULLUP);
|
|
tft.begin();
|
|
tft.setRotation(3);
|
|
tft.fillRect(0, y, X_MAX, Y_MAX, TFT_GREEN);
|
|
affBandeauBleu();
|
|
affHeure();
|
|
}
|
|
|
|
void loop() {
|
|
//affHeure();
|
|
}
|
|
|
|
|
|
void affBandeauBleu() {
|
|
tft.fillRect(0, 0, X_MAX, y, TFT_BLUE);
|
|
tft.drawChar(10, 10, '+', TFT_BLACK, TFT_BLUE, 3);
|
|
tft.drawChar(80, 10, '-', TFT_BLACK, TFT_BLUE, 3);
|
|
tft.setTextColor(TFT_BLACK);
|
|
tft.setTextSize(3);
|
|
tft.drawString("RAZ", 155, 10);
|
|
tft.drawChar(275, 10, ':', TFT_BLACK, TFT_BLUE, 3);
|
|
//sprintf(&s,"%d + %d = %d", a, b, c);
|
|
}
|
|
|
|
void affHeure() {
|
|
//tft.setTextColor(TFT_BLUE);
|
|
//tft.drawNumber(hour, 240, 10);
|
|
//tft.drawNumber(myTimeInMin, 285, 10);
|
|
|
|
myTimeInSec = millis()/1000;
|
|
myTimeInMin = myTimeInSec%60;
|
|
hour = myTimeInMin%60+12;
|
|
|
|
tft.setTextColor(TFT_BLACK);
|
|
tft.drawNumber(hour, 240, 10);
|
|
tft.drawNumber(myTimeInMin, 285, 10);
|
|
delay(1000);
|
|
} |