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);