From 0d47db2001a1625b89b4c6643b43143450ae83eb Mon Sep 17 00:00:00 2001 From: Remi NEVEU Date: Tue, 7 May 2024 16:55:32 +0200 Subject: [PATCH 1/2] Ajouter 'cadeau' --- cadeau | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 cadeau diff --git a/cadeau b/cadeau new file mode 100644 index 0000000..13692fd --- /dev/null +++ b/cadeau @@ -0,0 +1,48 @@ +#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 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(); + myTimeInSec = millis()/1000; + myTimeInMin = myTimeInSec%60; + hour = (myTimeInSec%60)%60+8; + tft.setRotation(3); + tft.fillRect(0, y, X_MAX, Y_MAX, TFT_GREEN); + affBandeauBleu(); +} + +void loop() { + Serial.print("Time: "); + myTimeInSec = millis()/1000; + Serial.println(myTimeInSec); // prints time since program started + Serial.print("Hour: "); + Serial.println(hour); + delay(1000); +} + + +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.drawNumber(hour, 270, 10); + //sprintf(&s,"%d + %d = %d", a, b, c); + +} From 887562560903b2103ac83f44325a4d033ae46c8d Mon Sep 17 00:00:00 2001 From: Remi NEVEU Date: Tue, 7 May 2024 17:23:56 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'code=5Fremi'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cadeau => code_remi | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) rename cadeau => code_remi (71%) diff --git a/cadeau b/code_remi similarity index 71% rename from cadeau rename to code_remi index 13692fd..333b7b8 100644 --- a/cadeau +++ b/code_remi @@ -6,8 +6,10 @@ 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); @@ -17,21 +19,14 @@ void setup() { pinMode(WIO_5S_RIGHT, INPUT_PULLUP); pinMode(WIO_5S_PRESS, INPUT_PULLUP); tft.begin(); - myTimeInSec = millis()/1000; - myTimeInMin = myTimeInSec%60; - hour = (myTimeInSec%60)%60+8; tft.setRotation(3); tft.fillRect(0, y, X_MAX, Y_MAX, TFT_GREEN); affBandeauBleu(); + affHeure(); } void loop() { - Serial.print("Time: "); - myTimeInSec = millis()/1000; - Serial.println(myTimeInSec); // prints time since program started - Serial.print("Hour: "); - Serial.println(hour); - delay(1000); + //affHeure(); } @@ -42,7 +37,21 @@ void affBandeauBleu() { tft.setTextColor(TFT_BLACK); tft.setTextSize(3); tft.drawString("RAZ", 155, 10); - tft.drawNumber(hour, 270, 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); +} \ No newline at end of file