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