Mise à jour de 'sujet'

master
Adryen DECHANDON 1 year ago
parent e9239a7792
commit e308467d02

66
sujet

@ -2,6 +2,8 @@
#include "RTC_SAMD51.h" #include "RTC_SAMD51.h"
#include "DateTime.h" #include "DateTime.h"
RTC_SAMD51 rtc; RTC_SAMD51 rtc;
int X_MAX = 320; int X_MAX = 320;
int Y_MAX = 240; int Y_MAX = 240;
@ -13,6 +15,8 @@ int ancien_affluence = 0;
int y = Y_MAX/5; int y = Y_MAX/5;
int background = TFT_GREEN; int background = TFT_GREEN;
int etatmessage15 = 0;
DateTime now = DateTime(F(__DATE__), F(__TIME__)); DateTime now = DateTime(F(__DATE__), F(__TIME__));
@ -43,6 +47,7 @@ void setup() {
void loop() { void loop() {
visiteur(); visiteur();
affHeure(); affHeure();
message15();
} }
@ -68,17 +73,41 @@ void affHeure() {
} }
void message15(){
if(now.minute() == 0 || now.minute() == 15 || now.minute() == 30 || now.minute() == 45 || now.minute() == 60){
if(etatmessage15 == 0 ){
Serial.println("--------");
Serial.print("heure : ");
Serial.print(now.hour());
Serial.print(":");
Serial.println(now.minute());
Serial.print("visiteur : ");
Serial.println(visit_total);
Serial.print("affluence : ");
Serial.println(affluence);
Serial.println("--------");
etatmessage15 = 1;
}
}
if(now.minute() != 0 && now.minute() != 15 && now.minute() != 30 && now.minute() != 45 && now.minute() != 60 ){
etatmessage15 = 0;
}
}
void visiteur() { void visiteur() {
int etat = 0; int etat = 0;
if (digitalRead(WIO_KEY_B) == LOW) { if (digitalRead(WIO_KEY_B) == LOW) {
ancien_affluence = affluence; ancien_affluence = affluence;
affluence = affluence -1; // Decrease affluence affluence = affluence -1; // Decrease affluence
if(affluence < 0){ if(affluence < 0){
Serial.println("impossible d'être négatif !");
affluence = 0; affluence = 0;
} }
if(affluence <= 10){ if(affluence <= 10){
Serial.println("attention l'affluence à dépassé 10 !");
background = TFT_GREEN; background = TFT_GREEN;
tft.fillScreen(background); // Green background tft.fillScreen(background); // Green background
affiche(); affiche();
@ -87,10 +116,6 @@ void visiteur() {
} }
efface(); efface();
affiche(); affiche();
Serial.print("visit_total = ");
Serial.println(visit_total);
Serial.print("affluence = ");
Serial.println(affluence);
} }
else if (digitalRead(WIO_KEY_C) == LOW) { else if (digitalRead(WIO_KEY_C) == LOW) {
@ -100,7 +125,6 @@ void visiteur() {
if(affluence == 11) if(affluence == 11)
tone(WIO_BUZZER, 442); tone(WIO_BUZZER, 442);
if(affluence > 10){ if(affluence > 10){
Serial.println("attention l'affluence à dépassé 10 !");
background = TFT_RED; background = TFT_RED;
tft.fillScreen(background); // Green background tft.fillScreen(background); // Green background
affiche(); affiche();
@ -110,10 +134,6 @@ void visiteur() {
} }
efface(); efface();
affiche(); affiche();
Serial.print("visit_total = ");
Serial.println(visit_total);
Serial.print("affluence = ");
Serial.println(affluence);
} }
else if (digitalRead(WIO_KEY_A) == LOW) { else if (digitalRead(WIO_KEY_A) == LOW) {
@ -126,6 +146,20 @@ void visiteur() {
visit_total = 0; visit_total = 0;
affluence = 0; affluence = 0;
etat = 0; etat = 0;
Serial.println("remise à 0 !!! ");
Serial.println("--------");
Serial.print("heure : ");
Serial.print(now.hour());
Serial.print(":");
Serial.println(now.minute());
Serial.print("visiteur : ");
Serial.println(visit_total);
Serial.print("affluence : ");
Serial.println(affluence);
Serial.println("--------");
} }
tft.setTextColor(background); tft.setTextColor(background);
@ -133,10 +167,11 @@ void visiteur() {
tft.drawString("Confirmez ?", 110, 200); tft.drawString("Confirmez ?", 110, 200);
efface(); efface();
affiche(); affiche();
Serial.print("visit_total = "); background = TFT_GREEN;
Serial.println(visit_total); tft.fillScreen(background); // Green background
Serial.print("affluence = "); affiche();
Serial.println(affluence); affBandeauBleu();
affHeure();
} }
delay(200); delay(200);
} }
@ -170,7 +205,6 @@ int compteur(){
int i = 5; int i = 5;
while( i > 0){ while( i > 0){
delay(1000); delay(1000);
Serial.println(i);
i--; i--;
if(digitalRead(WIO_5S_PRESS) == LOW){ if(digitalRead(WIO_5S_PRESS) == LOW){
return 1; return 1;

Loading…
Cancel
Save