From 304b1e4182cdaa99d5ad52670d2fd624d1133d24 Mon Sep 17 00:00:00 2001 From: Thibaud LA RIVIERE-GILLET Date: Thu, 16 May 2024 11:06:46 +0200 Subject: [PATCH] Update 'script/script.ino' --- script/script.ino | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/script/script.ino b/script/script.ino index 28f8dde..eaed073 100644 --- a/script/script.ino +++ b/script/script.ino @@ -14,7 +14,7 @@ short second = 0; unsigned int actuel = 0; unsigned int visiteurs = 0; -const unsigned short maxAffluence = 15; +const unsigned short maxAffluence = 10; int resetTime; String minuteString; @@ -82,12 +82,19 @@ void add() visiteurs++; actuel++; - if (actuel <= maxAffluence){ + if (actuel <= maxAffluence) + { tft.fillRect(0,41,320,240,TFT_GREEN); } else { tft.fillRect(0,41,320,240,TFT_RED); + if (actuel == maxAffluence + 1) + { + analogWrite(WIO_BUZZER, 128); + delay(100000); + analogWrite(WIO_BUZZER, LOW); + } } tft.drawString("affluence: " + String(actuel), 20, 75); tft.drawString("visiteurs: " + String(visiteurs), 20, 100); @@ -100,10 +107,18 @@ void substract() { actuel--; - if (actuel <= maxAffluence){ + if (actuel <= maxAffluence) + { tft.fillRect(0,41,320,240,TFT_GREEN); + if (actuel == maxAffluence) + { + analogWrite(WIO_BUZZER, 128); + delay(100000); + analogWrite(WIO_BUZZER, LOW); + } } - else{ + else + { tft.fillRect(0,41,320,240,TFT_RED); } tft.drawString("affluence: " + String(actuel), 20, 75);