|
|
@ -1,5 +1,8 @@
|
|
|
|
#include "TFT_eSPI.h"
|
|
|
|
#include "TFT_eSPI.h"
|
|
|
|
|
|
|
|
#include "RTC_SAMD51.h"
|
|
|
|
|
|
|
|
#include "DateTime.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RTC_SAMD51 rtc;
|
|
|
|
int X_MAX = 320;
|
|
|
|
int X_MAX = 320;
|
|
|
|
int Y_MAX = 240;
|
|
|
|
int Y_MAX = 240;
|
|
|
|
TFT_eSPI tft;
|
|
|
|
TFT_eSPI tft;
|
|
|
@ -10,17 +13,23 @@ int ancien_affluence = 0;
|
|
|
|
int y = Y_MAX/5;
|
|
|
|
int y = Y_MAX/5;
|
|
|
|
int background = TFT_GREEN;
|
|
|
|
int background = TFT_GREEN;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DateTime now = DateTime(F(__DATE__), F(__TIME__));
|
|
|
|
unsigned long myTimeInSec;
|
|
|
|
|
|
|
|
unsigned long myTimeInMin;
|
|
|
|
|
|
|
|
unsigned long hour;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
void setup() {
|
|
|
|
|
|
|
|
rtc.begin();
|
|
|
|
tft.begin();
|
|
|
|
tft.begin();
|
|
|
|
tft.setRotation(3); // Set the screen orientation
|
|
|
|
tft.setRotation(3); // Set the screen orientation
|
|
|
|
tft.fillScreen(background); // Green background
|
|
|
|
tft.fillScreen(background); // Green background
|
|
|
|
|
|
|
|
Serial.begin(115200);
|
|
|
|
|
|
|
|
while (!Serial)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
tft.setTextColor(TFT_BLACK);
|
|
|
|
|
|
|
|
tft.setTextSize(3);
|
|
|
|
|
|
|
|
tft.drawString("Need Serial Com", 10, 100);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
tft.setTextColor(TFT_GREEN);
|
|
|
|
|
|
|
|
tft.drawString("Need Serial Com", 10, 100);
|
|
|
|
pinMode(WIO_KEY_A, INPUT_PULLUP);
|
|
|
|
pinMode(WIO_KEY_A, INPUT_PULLUP);
|
|
|
|
pinMode(WIO_KEY_B, INPUT_PULLUP);
|
|
|
|
pinMode(WIO_KEY_B, INPUT_PULLUP);
|
|
|
|
pinMode(WIO_KEY_C, INPUT_PULLUP);
|
|
|
|
pinMode(WIO_KEY_C, INPUT_PULLUP);
|
|
|
@ -28,10 +37,12 @@ void setup() {
|
|
|
|
affiche();
|
|
|
|
affiche();
|
|
|
|
affBandeauBleu();
|
|
|
|
affBandeauBleu();
|
|
|
|
affHeure();
|
|
|
|
affHeure();
|
|
|
|
|
|
|
|
rtc.adjust(now);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
void loop() {
|
|
|
|
visiteur();
|
|
|
|
visiteur();
|
|
|
|
|
|
|
|
affHeure();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -47,20 +58,16 @@ void affBandeauBleu() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void affHeure() {
|
|
|
|
void affHeure() {
|
|
|
|
//tft.setTextColor(TFT_BLUE);
|
|
|
|
tft.setTextColor(TFT_BLUE);
|
|
|
|
//tft.drawNumber(hour, 240, 10);
|
|
|
|
tft.drawNumber(now.hour(), 240, 10);
|
|
|
|
//tft.drawNumber(myTimeInMin, 285, 10);
|
|
|
|
tft.drawNumber(now.minute(), 285, 10);
|
|
|
|
|
|
|
|
now = rtc.now();
|
|
|
|
myTimeInSec = millis()/1000;
|
|
|
|
|
|
|
|
myTimeInMin = myTimeInSec%60;
|
|
|
|
|
|
|
|
hour = myTimeInMin%60+12;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tft.setTextColor(TFT_BLACK);
|
|
|
|
tft.setTextColor(TFT_BLACK);
|
|
|
|
tft.drawNumber(hour, 240, 10);
|
|
|
|
tft.drawNumber(now.hour(), 240, 10);
|
|
|
|
tft.drawNumber(myTimeInMin, 285, 10);
|
|
|
|
tft.drawNumber(now.minute(), 285, 10);
|
|
|
|
delay(1000);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void visiteur() {
|
|
|
|
void visiteur() {
|
|
|
|
int etat = 0;
|
|
|
|
int etat = 0;
|
|
|
|
if (digitalRead(WIO_KEY_B) == LOW) {
|
|
|
|
if (digitalRead(WIO_KEY_B) == LOW) {
|
|
|
@ -70,7 +77,7 @@ void visiteur() {
|
|
|
|
Serial.println("impossible d'être négatif !");
|
|
|
|
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 !");
|
|
|
|
Serial.println("attention l'affluence à dépassé 10 !");
|
|
|
|
background = TFT_GREEN;
|
|
|
|
background = TFT_GREEN;
|
|
|
|
tft.fillScreen(background); // Green background
|
|
|
|
tft.fillScreen(background); // Green background
|
|
|
@ -84,16 +91,21 @@ void visiteur() {
|
|
|
|
Serial.println(visit_total);
|
|
|
|
Serial.println(visit_total);
|
|
|
|
Serial.print("affluence = ");
|
|
|
|
Serial.print("affluence = ");
|
|
|
|
Serial.println(affluence);
|
|
|
|
Serial.println(affluence);
|
|
|
|
} else if (digitalRead(WIO_KEY_C) == LOW) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if (digitalRead(WIO_KEY_C) == LOW) {
|
|
|
|
ancien();
|
|
|
|
ancien();
|
|
|
|
affluence = affluence +1; // Increase affluence
|
|
|
|
affluence = affluence +1; // Increase affluence
|
|
|
|
visit_total = visit_total +1; // Increment visit_total
|
|
|
|
visit_total = visit_total +1; // Increment visit_total
|
|
|
|
|
|
|
|
if(affluence == 11)
|
|
|
|
|
|
|
|
tone(WIO_BUZZER, 442);
|
|
|
|
if(affluence > 10){
|
|
|
|
if(affluence > 10){
|
|
|
|
Serial.println("attention l'affluence à dépassé 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();
|
|
|
|
affBandeauBleu();
|
|
|
|
affBandeauBleu();
|
|
|
|
|
|
|
|
noTone(WIO_BUZZER);
|
|
|
|
affHeure();
|
|
|
|
affHeure();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
efface();
|
|
|
|
efface();
|
|
|
@ -102,7 +114,9 @@ void visiteur() {
|
|
|
|
Serial.println(visit_total);
|
|
|
|
Serial.println(visit_total);
|
|
|
|
Serial.print("affluence = ");
|
|
|
|
Serial.print("affluence = ");
|
|
|
|
Serial.println(affluence);
|
|
|
|
Serial.println(affluence);
|
|
|
|
} else if (digitalRead(WIO_KEY_A) == LOW) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if (digitalRead(WIO_KEY_A) == LOW) {
|
|
|
|
tft.setTextColor(TFT_BLACK);
|
|
|
|
tft.setTextColor(TFT_BLACK);
|
|
|
|
tft.setTextSize(3);
|
|
|
|
tft.setTextSize(3);
|
|
|
|
tft.drawString("Confirmez ?", 110, 200);
|
|
|
|
tft.drawString("Confirmez ?", 110, 200);
|
|
|
|