|
|
|
@ -23,60 +23,13 @@ String hourString;
|
|
|
|
|
/*########################################################*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
|
Serial.begin(115200);
|
|
|
|
|
|
|
|
|
|
rtc.adjust(now);
|
|
|
|
|
now = rtc.now();
|
|
|
|
|
second = now.second();
|
|
|
|
|
minute = now.minute();
|
|
|
|
|
hour = now.hour();
|
|
|
|
|
|
|
|
|
|
tft.begin();
|
|
|
|
|
tft.setRotation(3);
|
|
|
|
|
tft.setTextColor(TFT_BLACK);
|
|
|
|
|
tft.setTextSize(3);
|
|
|
|
|
|
|
|
|
|
tft.fillScreen(TFT_GREEN);
|
|
|
|
|
tft.drawString("Need serial com", 10, 10);
|
|
|
|
|
while (!Serial)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
pinMode(WIO_KEY_A, INPUT_PULLUP);
|
|
|
|
|
pinMode(WIO_KEY_B, INPUT_PULLUP);
|
|
|
|
|
pinMode(WIO_KEY_C, INPUT_PULLUP);
|
|
|
|
|
pinMode(WIO_5S_PRESS, INPUT_PULLUP);
|
|
|
|
|
|
|
|
|
|
tft.fillRect(0,0,320,40,TFT_BLUE); // BANDEAU DU HAUT
|
|
|
|
|
|
|
|
|
|
tft.drawString("+ - raz",5,10);
|
|
|
|
|
if (now.minute() < 10){
|
|
|
|
|
minuteString = "0" + String(now.minute());
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
minuteString = String(now.minute());
|
|
|
|
|
}
|
|
|
|
|
if (now.hour() < 10){
|
|
|
|
|
hourString = "0" + String(now.hour());
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
hourString = String(now.hour());
|
|
|
|
|
}
|
|
|
|
|
tft.drawString(hourString + ":" + minuteString,230,10);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tft.fillRect(0,41,320,240,TFT_GREEN); // Carré du bas
|
|
|
|
|
tft.drawString("affluence: " + String(actuel), 20, 75);
|
|
|
|
|
tft.drawString("visiteurs: " + String(visiteurs), 20, 100);
|
|
|
|
|
|
|
|
|
|
attachInterrupt(WIO_KEY_C, add, FALLING);
|
|
|
|
|
attachInterrupt(WIO_KEY_B, substract, FALLING);
|
|
|
|
|
attachInterrupt(WIO_KEY_A, resetInit, FALLING);
|
|
|
|
|
attachInterrupt(WIO_5S_PRESS, reset, FALLING);
|
|
|
|
|
void midDrawing() {
|
|
|
|
|
tft.drawString("affluence: " + String(actuel), 20, 125);
|
|
|
|
|
tft.drawString("visiteurs: " + String(visiteurs), 20, 75);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void add(){
|
|
|
|
|
visiteurs++;
|
|
|
|
|
actuel++;
|
|
|
|
@ -95,8 +48,7 @@ void add(){
|
|
|
|
|
analogWrite(WIO_BUZZER, LOW);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tft.drawString("affluence: " + String(actuel), 20, 75);
|
|
|
|
|
tft.drawString("visiteurs: " + String(visiteurs), 20, 100);
|
|
|
|
|
midDrawing();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -119,8 +71,7 @@ void substract(){
|
|
|
|
|
{
|
|
|
|
|
tft.fillRect(0,41,320,240,TFT_RED);
|
|
|
|
|
}
|
|
|
|
|
tft.drawString("affluence: " + String(actuel), 20, 75);
|
|
|
|
|
tft.drawString("visiteurs: " + String(visiteurs), 20, 100);
|
|
|
|
|
midDrawing();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -138,8 +89,7 @@ void reset()
|
|
|
|
|
actuel = 0;
|
|
|
|
|
visiteurs = 0;
|
|
|
|
|
tft.fillRect(0,41,320,240,TFT_GREEN);
|
|
|
|
|
tft.drawString("affluence: " + String(actuel), 20, 75);
|
|
|
|
|
tft.drawString("visiteurs: " + String(visiteurs), 20, 100);
|
|
|
|
|
midDrawing();
|
|
|
|
|
resetTime = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -159,6 +109,57 @@ void bar(){
|
|
|
|
|
tft.drawString(hourString + ":" + minuteString,230,10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
|
Serial.begin(115200);
|
|
|
|
|
|
|
|
|
|
rtc.adjust(now);
|
|
|
|
|
now = rtc.now();
|
|
|
|
|
second = now.second();
|
|
|
|
|
minute = now.minute();
|
|
|
|
|
hour = now.hour();
|
|
|
|
|
|
|
|
|
|
tft.begin();
|
|
|
|
|
tft.setRotation(3);
|
|
|
|
|
tft.setTextColor(TFT_BLACK);
|
|
|
|
|
tft.setTextSize(3);
|
|
|
|
|
|
|
|
|
|
tft.fillScreen(TFT_GREEN);
|
|
|
|
|
tft.drawString("Need serial com", 10, 10);
|
|
|
|
|
while (!Serial){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
pinMode(WIO_KEY_A, INPUT_PULLUP);
|
|
|
|
|
pinMode(WIO_KEY_B, INPUT_PULLUP);
|
|
|
|
|
pinMode(WIO_KEY_C, INPUT_PULLUP);
|
|
|
|
|
pinMode(WIO_5S_PRESS, INPUT_PULLUP);
|
|
|
|
|
|
|
|
|
|
tft.fillRect(0,0,320,40,TFT_BLUE); // BANDEAU DU HAUT
|
|
|
|
|
|
|
|
|
|
tft.drawString("+ - raz",5,10);
|
|
|
|
|
if (now.minute() < 10){
|
|
|
|
|
minuteString = "0" + String(now.minute());
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
minuteString = String(now.minute());
|
|
|
|
|
}
|
|
|
|
|
if (now.hour() < 10){
|
|
|
|
|
hourString = "0" + String(now.hour());
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
hourString = String(now.hour());
|
|
|
|
|
}
|
|
|
|
|
tft.drawString(hourString + ":" + minuteString,230,10);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tft.fillRect(0,41,320,240,TFT_GREEN);
|
|
|
|
|
midDrawing();
|
|
|
|
|
|
|
|
|
|
attachInterrupt(WIO_KEY_C, add, FALLING);
|
|
|
|
|
attachInterrupt(WIO_KEY_B, substract, FALLING);
|
|
|
|
|
attachInterrupt(WIO_KEY_A, resetInit, FALLING);
|
|
|
|
|
attachInterrupt(WIO_5S_PRESS, reset, FALLING);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
|
delay(1000);
|
|
|
|
|
second++;
|
|
|
|
|