Advertisement
Double_G

Untitled

Nov 22nd, 2020
778
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. void loop() {
  2.  
  3.   ido = timeClient.getFormattedTime();
  4.   tizperc = (ido.substring(3,4));
  5.   tizpercint= tizperc.toInt();
  6.   if (tizpercint != temppercint) {
  7.     timeClient.update();
  8.     temppercint = tizpercint;
  9.     Serial.println("ido frissitve");
  10.   }
  11.  
  12. Serial.println(ido);
  13. u8g2.clearBuffer();
  14. u8g2.setFont(u8g2_font_8x13_tr);
  15. u8g2.setDrawColor(1);
  16. u8g2.setFontPosTop();
  17. u8g2.setFontDirection(2);
  18. String ipString = WiFi.localIP().toString();
  19. u8g2.drawStr(127,31, (char *) ipString.c_str());
  20. u8g2.setFont(u8g2_font_10x20_tr);
  21. u8g2.drawStr(127,18, (char *) ido.c_str());
  22. u8g2.sendBuffer();
  23.  
  24.   if (ipString == "0.0.0.0") {
  25.     Serial.println("Az IP cim rossz!");
  26.     WiFi.disconnect();
  27.     Serial.println("lecsatlakozva");
  28.     delay(10000);
  29.     WiFi.begin();
  30.     while (WiFi.status() != WL_CONNECTED) {
  31.       delay(500);
  32.       Serial.print('.');
  33.       }
  34.     Serial.println("felcsatlakozva");
  35.    }
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement