Update 'script/script.ino'

master
parent 3505ced419
commit 5c146c3756

@ -26,8 +26,6 @@ String hourString;
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
rtc.adjust(now); rtc.adjust(now);
now = rtc.now(); now = rtc.now();
second = now.second(); second = now.second();
@ -38,10 +36,11 @@ void setup() {
tft.setRotation(3); tft.setRotation(3);
tft.setTextColor(TFT_BLACK); tft.setTextColor(TFT_BLACK);
tft.setTextSize(3); tft.setTextSize(3);
while (!Serial){
tft.fillScreen(TFT_GREEN); tft.fillScreen(TFT_GREEN);
tft.drawString("Need serial com", 10, 10); tft.drawString("Need serial com", 10, 10);
} while (!Serial)
continue;
pinMode(WIO_KEY_A, INPUT_PULLUP); pinMode(WIO_KEY_A, INPUT_PULLUP);
pinMode(WIO_KEY_B, INPUT_PULLUP); pinMode(WIO_KEY_B, INPUT_PULLUP);
@ -86,7 +85,8 @@ void add()
if (actuel <= maxAffluence){ if (actuel <= maxAffluence){
tft.fillRect(0,41,320,240,TFT_GREEN); tft.fillRect(0,41,320,240,TFT_GREEN);
} }
else{ else
{
tft.fillRect(0,41,320,240,TFT_RED); tft.fillRect(0,41,320,240,TFT_RED);
} }
tft.drawString("affluence: " + String(actuel), 20, 75); tft.drawString("affluence: " + String(actuel), 20, 75);
@ -105,10 +105,10 @@ void substract()
} }
else{ else{
tft.fillRect(0,41,320,240,TFT_RED); tft.fillRect(0,41,320,240,TFT_RED);
}
tft.drawString("affluence: " + String(actuel), 20, 75); tft.drawString("affluence: " + String(actuel), 20, 75);
tft.drawString("visiteurs: " + String(visiteurs), 20, 100); tft.drawString("visiteurs: " + String(visiteurs), 20, 100);
} }
}
} }
void resetInit() void resetInit()
@ -150,14 +150,14 @@ void loop() {
delay(1000); delay(1000);
second++; second++;
Serial.println(second); Serial.println(second);
if (second%60 == 0){ if (second%60 == 0)
{
minute++; minute++;
if (minute%60 == 0){ if (minute%60 == 0)
hour++; hour++;
} if (hour%24 == 0)
if (hour == 24){
hour = 0; hour = 0;
}
bar(); bar();
} }
} }

Loading…
Cancel
Save