SHARE
TWEET

StaticDisplay

Stybyk Jun 2nd, 2020 904 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void DrawDHTtemp() {
  2.   epochTime = timeClient.getEpochTime();
  3.   display.clearDisplay();
  4.   display.setTextSize(1);
  5.   display.setTextColor(WHITE);
  6.   display.setCursor(20, 0);
  7.   display.print("DHT Teplota ");
  8.   display.print(DHTtemp);
  9.   display.println(" C");
  10.  
  11.   display.drawLine(xl - 2, display.height() - yl, display.width() - 10, display.height() - yl, WHITE); /// Osa X
  12.   display.drawLine(xl , yl, xl, display.height() - yl   , WHITE); // Osa Y
  13.   int Xmark = 0 ;
  14.   unsigned long epoch = 0;
  15.   for (int i = 0; i <= 24; i = i + 4) {
  16.     Xmark = xl + 1 + i * 4;
  17.     // Serial.println(Xmark);
  18.     display.drawPixel(Xmark, display.height() - yl - 1, WHITE); // pixel pod oxou X ,každá 4 hodina
  19.     display.drawPixel(Xmark, display.height() - yl + 1, WHITE); // pixel nad osou X ,každá 4 hodina
  20.     display.setCursor(Xmark - 2 , display.height() - 9 );
  21.  
  22.     epoch = epochTime - (( 24 - i) * 3600 ) ;
  23.     ntp_second = epoch % 60;
  24.     epoch /= 60;
  25.     ntp_minute = epoch % 60;
  26.     epoch /= 60;
  27.     ntp_hour  = epoch % 24;
  28.     epoch /= 24;
  29.  
  30.     display.println(ntp_hour);
  31.     //  Serial.print(ntp_hour); Serial.print("hod pro x="); Serial.println(Xmark);
  32.   }
  33.   int Ymark = 0;
  34.   for (int i = 0; i <= 4; i++) {
  35.     Ymark = display.height() - yl - i * 10 - 1 ;
  36.     // Serial.println(Ymark);
  37.     display.drawPixel(xl - 1,  Ymark, WHITE); // pixel pod oxou X ,každá 4 hodina
  38.     display.setCursor(0 , Ymark - 4);
  39.     display.print(20 + i * 2 );
  40.  
  41.   }
  42.  
  43.   int TimeShift, TempYposition, TempXposition;
  44.   for (int i = DHT_day_temp.size(); i >= 0; i--) {
  45.     ESP.wdtFeed();
  46.     TimeShift = now / 15;
  47.     TempYposition = (display.height() - yl) - ((DHT_day_temp[i] / 0.2) - 100);
  48.     TempXposition = display.width() - 17 - i + TimeShift;
  49.     display.drawPixel(TempXposition , TempYposition , WHITE);
  50.     //   Serial.print("Teplota:"); Serial.print(DHT_day_temp[i]); Serial.print("Pro cas T - "); Serial.print(i * 15); Serial.print("min ulozen x = "); Serial.println(TempXposition);
  51.   }
  52.  
  53.   display.display();
  54.  
  55. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top