Esp8266 wheather station

i want to make a wheather forcast display using esp8266 nodemcu and tft display. the program works fine if program my wifi ssid in code like this:

#include <Adafruit_GFX.h>      // include Adafruit graphics library
#include <Adafruit_ST7735.h>   // include Adafruit ST7735 TFT library
#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <JsonListener.h>
#include <time.h>
#include "OpenWeatherMapCurrent.h"
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#include <Fonts/FreeMono12pt7b.h>
#include <Fonts/FreeSans9pt7b.h>
#include <Fonts/FreeSans12pt7b.h>
#include <Fonts/FreeSansBold18pt7b.h>
#include <Fonts/FreeSansBold9pt7b.h>

OpenWeatherMapCurrent client;

// ST7735 TFT module connections
#define TFT_RST   D4     // TFT RST pin is connected to NodeMCU pin D4 (GPIO2)
#define TFT_CS    D3     // TFT CS  pin is connected to NodeMCU pin D4 (GPIO0)
#define TFT_DC    D2     // TFT DC  pin is connected to NodeMCU pin D4 (GPIO4)
#define Buzzer    D8
#define Led       D1

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);


String OPEN_WEATHER_MAP_APP_ID = "2bc3211721669d0ed3e9a3d846200c77";
String OPEN_WEATHER_MAP_LOCATION = "Surabaya";
String OPEN_WEATHER_MAP_LANGUAGE = "en";
boolean IS_METRIC = true;

const char* ESP_HOST_NAME = "esp-" + ESP.getFlashChipId();
const char* WIFI_SSID     = "Home";
const char* WIFI_PASSWORD = "12345678";

const long utcOffsetInSeconds = 25200;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "pool.ntp.org", utcOffsetInSeconds);
uint16_t colors[7]={0xF800, 0xFB20, 0xFFE0, 0x87E0, 0x04E0, 0x07FF, 0x03DF};
uint16_t col=0;
const unsigned char thunder[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00111110,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000001,B11100011,B11000000,B00000000,B00000000,
  B00000000,B00000000,B00000011,B00000000,B01100000,B00000000,B00000000,
  B00000000,B00000000,B00000100,B00000000,B00110000,B00000000,B00000000,
  B00000000,B00000000,B00001000,B00000000,B00011000,B00000000,B00000000,
  B00000000,B00000000,B00010000,B00000000,B00001100,B00000000,B00000000,
  B00000000,B00000000,B00110000,B00000000,B00000111,B11000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,B01100000,B00000000,
  B00000000,B00001111,B11100000,B00000000,B00000000,B00010000,B00000000,
  B00000000,B00011000,B00000000,B00000000,B00000000,B00011000,B00000000,
  B00000000,B00100000,B00000000,B00000000,B00000000,B00001000,B00000000,
  B00000000,B01100000,B00000000,B00000000,B00000000,B00001100,B00000000,
  B00000000,B01000000,B00000000,B00000000,B00000000,B00001100,B00000000,
  B00000000,B11000000,B00000000,B00000000,B00000000,B00001100,B00000000,
  B00001111,B10000000,B00000000,B00000100,B00000000,B00001000,B00000000,
  B00011000,B00000000,B00000000,B00000100,B00000000,B00001100,B00000000,
  B00110000,B00000000,B00000000,B00001100,B00000000,B00000110,B00000000,
  B00100000,B00000000,B00000000,B00001000,B00000000,B00000010,B00000000,
  B01100000,B00000000,B00000000,B00011000,B00000000,B00000011,B00000000,
  B01000000,B00000000,B00000000,B00010000,B00000000,B00000001,B00000000,
  B01000000,B00000000,B00010000,B00110000,B00000000,B00000001,B00000000,
  B01000000,B00000000,B00110000,B00100000,B00000000,B00000001,B00000000,
  B01100000,B00000000,B00100000,B00100000,B00000000,B00000011,B00000000,
  B00100000,B00000000,B01100000,B01111111,B10000000,B00000010,B00000000,
  B00010000,B00000000,B01000000,B01111111,B10000000,B00000110,B00000000,
  B00011100,B00000000,B01111000,B00000001,B00000000,B00011100,B00000000,
  B00000111,B11111100,B00001000,B00000011,B00111111,B11110000,B00000000,
  B00000000,B00000000,B00011000,B00000010,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00010000,B00000010,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00110000,B00000100,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000100,B00000000,B00000000,B00000000,
  B00000000,B00000000,B01100000,B00001100,B00000000,B00000000,B00000000,
  B00000000,B00000000,B01000000,B00001000,B00000000,B00000000,B00000000,
  B00010000,B00000110,B00000000,B10000000,B00010000,B00000100,B00000000,
  B00110000,B00000100,B00000001,B10000000,B00100000,B00000100,B00000000,
  B00100000,B00001100,B00000001,B00000000,B00100000,B00001100,B00000000,
  B01100000,B00001000,B00000001,B00000000,B01100000,B00001000,B00000000,
  B01000000,B00001000,B00000011,B00000000,B01000000,B00011000,B00000000,
  B01000000,B00000000,B00000010,B00000000,B01000000,B00010000,B00000000
};


const unsigned char drizzle[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01111111,B11000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B11100000,B11100000,B00000000,B00000000,
  B00000000,B00000000,B00000011,B10000000,B00111000,B00000000,B00000000,
  B00000000,B00000000,B00000110,B00000000,B00001100,B00000000,B00000000,
  B00000000,B00000000,B00000100,B00000000,B00000110,B00000000,B00000000,
  B00000000,B00000000,B00001100,B00000000,B00000010,B00000000,B00000000,
  B00000000,B00000000,B00011000,B00000000,B00000011,B11100000,B00000000,
  B00000000,B00000000,B00010000,B00000000,B00000001,B11111000,B00000000,
  B00000000,B00000011,B11110000,B00000000,B00000000,B00001100,B00000000,
  B00000000,B00001110,B01110000,B00000000,B00000000,B00000110,B00000000,
  B00000000,B00011000,B00000000,B00000000,B00000000,B00000110,B00000000,
  B00000000,B00100000,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00000000,B01100000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00000000,B01000000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00000000,B11000000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00000111,B11000000,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00011100,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00010000,B00000000,B00000000,B00000000,B00000000,B00000001,B00000000,
  B00100000,B00000000,B00000000,B00000000,B00000000,B00000001,B10000000,
  B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B11000000,
  B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11000000,
  B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000000,
  B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000000,
  B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000000,
  B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B11000000,
  B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00110000,B00000000,B00000000,B00000000,B00000000,B00000001,B10000000,
  B00011000,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00001110,B00000000,B00000000,B00000000,B00000000,B00001110,B00000000,
  B00000111,B11111111,B11111111,B11111111,B11111111,B11111100,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B11000000,B00110000,B00001100,B00000011,B00000000,B00000000,
  B00000000,B11000000,B00100000,B00001000,B00000010,B00000000,B00000000,
  B00000000,B10000000,B00100000,B00011000,B00000110,B00000000,B00000000,
  B00000001,B10000000,B01100000,B00010000,B00000100,B00000000,B00000000,
  B00000001,B00000000,B01000000,B00110000,B00000100,B00000000,B00000000,
  B00000001,B00000000,B01000000,B00110000,B00001100,B00000000,B00000000
};


const unsigned char rain[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B11111110,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000011,B00000001,B10001111,B11110000,B00000000,B00000000,
  B00000000,B00000110,B00000000,B11110000,B00001100,B00000000,B00000000,
  B00000000,B00001100,B00000000,B01000000,B00000110,B00000000,B00000000,
  B00000000,B01111000,B00000000,B10000000,B00000011,B00000000,B00000000,
  B00000001,B10000000,B00000001,B10000000,B00000001,B11100000,B00000000,
  B00000001,B00000000,B00000001,B00000000,B00000000,B00011000,B00000000,
  B00000001,B00000000,B01111111,B00000000,B00000000,B00001100,B00000000,
  B00000001,B00000000,B11000000,B00000000,B00000000,B00000110,B00000000,
  B00000001,B00000001,B10000000,B00000000,B00000000,B00000010,B00000000,
  B00000011,B00000001,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00000110,B00000111,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00000100,B00111000,B00000000,B00000000,B00000000,B00000110,B00000000,
  B00000100,B01100000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00000100,B01000000,B00000000,B00000000,B00000000,B00000001,B00000000,
  B00000110,B11000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00000011,B10000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00000001,B10000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00000000,B01000000,B00000000,B00000000,B00000000,B00000001,B10000000,
  B00000000,B01000000,B00000000,B00000000,B00000000,B00000001,B00000000,
  B00000000,B00100000,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00000000,B00011111,B11111111,B11111111,B11111111,B11111100,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000010,B00000001,B00000000,B10000000,B01000000,B00110000,B00000000,
  B00000100,B00000010,B00000001,B10000000,B01000000,B00100000,B00000000,
  B00000100,B00000010,B00000001,B00000000,B10000000,B01100000,B00000000,
  B00001000,B00000100,B00000011,B00000000,B10000000,B01000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000001,B00000000,B00000000,
  B00100000,B00010000,B00001000,B00000110,B00000001,B00000000,B00000000,
  B01100000,B00110000,B00001000,B00000100,B00000010,B00000000,B00000000,
  B01000000,B00100000,B00010000,B00001100,B00000010,B00000000,B00000000,
  B11000000,B01100000,B00010000,B00001000,B00000100,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000
};

const unsigned char snow[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00100000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00100000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00100000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00010000,B00100000,B01000000,B00000000,B00000000,
  B00000000,B00000000,B00011000,B00100000,B11000000,B00000000,B00000000,
  B00000000,B00000000,B00000110,B00100001,B10000000,B00000000,B00000000,
  B00000000,B00000000,B00000011,B00100110,B00000000,B00000000,B00000000,
  B00000000,B00100000,B00000000,B10101100,B00000000,B00100000,B00000000,
  B00000000,B00010000,B00000000,B01110000,B00000000,B01100000,B00000000,
  B00000000,B00010000,B00000000,B00100000,B00000000,B01000000,B00000000,
  B00011100,B00011000,B00000000,B00100000,B00000000,B11000001,B11000000,
  B00000011,B00001000,B00000000,B01110000,B00000000,B10000111,B00000000,
  B00000000,B11101100,B00000000,B11111000,B00000000,B10111000,B00000000,
  B00000000,B00011100,B00000011,B00100110,B00000001,B11000000,B00000000,
  B00000000,B11111111,B11111100,B00100001,B11111111,B11111000,B00000000,
  B00011111,B00000001,B11100000,B00100000,B00111100,B00000111,B11000000,
  B00000000,B00000000,B11011000,B00100000,B11111000,B00000000,B00000000,
  B00000000,B00000000,B01000111,B00100011,B00011000,B00000000,B00000000,
  B00000000,B00000000,B01000001,B11111100,B00010000,B00000000,B00000000,
  B00000000,B00000000,B01000000,B01111000,B00010000,B00000000,B00000000,
  B00000000,B00000000,B01000011,B10100110,B00010000,B00000000,B00000000,
  B00000000,B00000000,B11011100,B00100001,B11011000,B00000000,B00000000,
  B00011100,B00000000,B11100000,B00100000,B00111100,B00000001,B11000000,
  B00000011,B11110011,B11111000,B00100000,B11111110,B01111110,B00000000,
  B00000000,B00011110,B00000111,B00100011,B10000001,B11000000,B00000000,
  B00000000,B01111100,B00000001,B10101100,B00000001,B10110000,B00000000,
  B00000001,B10001000,B00000000,B01111000,B00000000,B10001110,B00000000,
  B00001110,B00001000,B00000000,B00110000,B00000000,B11000011,B10000000,
  B00010000,B00011000,B00000000,B00100000,B00000000,B01000000,B00000000,
  B00000000,B00010000,B00000000,B01110000,B00000000,B01100000,B00000000,
  B00000000,B00110000,B00000000,B11111000,B00000000,B00100000,B00000000,
  B00000000,B00100000,B00000001,B10100110,B00000000,B00100000,B00000000,
  B00000000,B00000000,B00000110,B00100011,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00001100,B00100001,B10000000,B00000000,B00000000,
  B00000000,B00000000,B00010000,B00100000,B01100000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00100000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00100000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000
};

const unsigned char mist[] PROGMEM = {
  B00000000,B00000000,B00000011,B11111000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00001111,B11111111,B10000000,B00000000,B00000000,
  B00000000,B00000000,B00111000,B00000011,B11000000,B00000000,B00000000,
  B00000000,B00000000,B01110000,B00000000,B01100000,B00000000,B00000000,
  B00000000,B00000000,B11000000,B00000000,B00111000,B00000000,B00000000,
  B00000000,B00000011,B10000000,B00000000,B00011111,B11110000,B00000000,
  B00000000,B00000011,B00000000,B00000000,B00011111,B11111110,B00000000,
  B00000000,B00000111,B00000000,B00000000,B00000000,B00001111,B00000000,
  B00000000,B11111111,B11000000,B00000000,B00000000,B00000001,B11000000,
  B00000111,B11000000,B11111000,B00000000,B00000000,B00000001,B11000000,
  B00001111,B00000000,B00111100,B00000000,B00000000,B00000000,B11100000,
  B00011000,B00000000,B00001111,B00000000,B00000000,B00000000,B11100000,
  B01110000,B00000000,B00000111,B10111100,B00000000,B00000000,B11100000,
  B01110000,B00000000,B00000011,B11111111,B11000000,B00000000,B11100000,
  B01100000,B00000000,B00000000,B10000001,B11100000,B00000000,B11100000,
  B11100000,B00000000,B00000000,B00000000,B00111000,B00000000,B11100000,
  B11100000,B00000000,B00000000,B00000000,B00011000,B00000000,B11000000,
  B11100000,B00000000,B00000000,B00000000,B00011100,B00000001,B11000000,
  B11100000,B00000000,B00000000,B00000000,B00011100,B00000011,B00000000,
  B11100000,B00000000,B00000000,B00000000,B00000100,B00011110,B00000000,
  B11100000,B00000000,B00000000,B00000000,B00000111,B11111100,B00000000,
  B01100000,B00000000,B00000000,B00000000,B00000111,B11000000,B00000000,
  B01110000,B00000000,B00000000,B00000000,B00011100,B00000000,B00000000,
  B00011000,B00000000,B00000000,B00000000,B00011100,B00000000,B00000000,
  B00011110,B00000000,B00000000,B00000000,B00111000,B00000000,B00000000,
  B00001111,B00000000,B00000000,B00000000,B01100000,B00000000,B00000000,
  B00000001,B11000000,B00000000,B00000011,B11000000,B00000000,B00000000,
  B00000000,B11111111,B11111111,B11111111,B10000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B11000011,B11110000,B11111001,B11111000,B01100000,B00000000,
  B00000000,B11111111,B11111111,B10111111,B11111111,B11100000,B00000000,
  B00000000,B00111100,B00001111,B00011110,B00000111,B10000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B11000011,B11110000,B11111001,B11111000,B01100000,B00000000,
  B00000000,B11111111,B11111111,B10111111,B11111111,B11100000,B00000000,
  B00000000,B00111100,B00001111,B00011110,B00000111,B10000000,B00000000
};

const unsigned char clearS[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000110,B00000000,B01000000,B00001100,B00000000,B00000000,
  B00000000,B00000011,B00000000,B01000000,B00011000,B00000000,B00000000,
  B00000000,B00000001,B00000000,B01000000,B00010000,B00000000,B00000000,
  B00000000,B00000000,B10000000,B10100000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B01011111,B00011111,B01000000,B00000000,B00000000,
  B00111000,B00000000,B01100000,B00000000,B11100000,B00000001,B10000000,
  B00000110,B00000001,B10000000,B00000000,B00011000,B00001100,B00000000,
  B00000001,B11000110,B00000000,B00000000,B00001100,B01110000,B00000000,
  B00000000,B00101100,B00000000,B00000000,B00000110,B11000000,B00000000,
  B00000000,B00001000,B00000000,B00000000,B00000011,B00000000,B00000000,
  B00000000,B00010000,B00000000,B00000000,B00000001,B00000000,B00000000,
  B00000000,B00110000,B00000000,B00000000,B00000001,B10000000,B00000000,
  B00000000,B00100000,B00000000,B00000000,B00000000,B10000000,B00000000,
  B00000000,B00100000,B00000000,B00000000,B00000000,B10000000,B00000000,
  B00111111,B11100000,B00000000,B00000000,B00000000,B11111111,B11000000,
  B00000000,B00100000,B00000000,B00000000,B00000000,B10000000,B00000000,
  B00000000,B00100000,B00000000,B00000000,B00000000,B10000000,B00000000,
  B00000000,B00110000,B00000000,B00000000,B00000001,B10000000,B00000000,
  B00000000,B00010000,B00000000,B00000000,B00000001,B00000000,B00000000,
  B00000000,B00001000,B00000000,B00000000,B00000011,B00000000,B00000000,
  B00000000,B01101100,B00000000,B00000000,B00000110,B11000000,B00000000,
  B00000001,B11000110,B00000000,B00000000,B00001100,B01110000,B00000000,
  B00001110,B00000001,B10000000,B00000000,B00110000,B00001110,B00000000,
  B00110000,B00000000,B01100000,B00000000,B11000000,B00000001,B10000000,
  B00000000,B00000000,B01011111,B00011111,B01100000,B00000000,B00000000,
  B00000000,B00000000,B10000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000001,B00000000,B01000000,B00010000,B00000000,B00000000,
  B00000000,B00000011,B00000000,B01000000,B00001000,B00000000,B00000000,
  B00000000,B00000110,B00000000,B01000000,B00001100,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000
};

const unsigned char clearS1[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00100000,B00100000,B00100000,B00000000,
  B00000000,B00100000,B00100000,B01000000,B00000000,
  B00000000,B00010000,B00100000,B01000000,B00000000,
  B00000000,B00001000,B01110000,B10000000,B00000000,
  B00000000,B00001011,B10001111,B10000000,B00000000,
  B00110000,B00001100,B00000001,B10000000,B01100000,
  B00001100,B00010000,B00000000,B11000001,B10000000,
  B00000110,B00100000,B00000000,B00100110,B00000000,
  B00000001,B01000000,B00000000,B00111100,B00000000,
  B00000000,B01000000,B00000000,B00010000,B00000000,
  B00000000,B10000000,B00000000,B00001000,B00000000,
  B00000000,B10000000,B00000000,B00001000,B00000000,
  B00000000,B10000000,B00000000,B00001000,B00000000,
  B00000001,B00000000,B00000000,B00001000,B00000000,
  B00111111,B00000000,B00000000,B00001111,B11100000,
  B00000001,B00000000,B00000000,B00001000,B00000000,
  B00000000,B10000000,B00000000,B00001000,B00000000,
  B00000000,B10000000,B00000000,B00001000,B00000000,
  B00000000,B10000000,B00000000,B00001000,B00000000,
  B00000000,B01000000,B00000000,B00010000,B00000000,
  B00000001,B01000000,B00000000,B00111100,B00000000,
  B00000110,B00100000,B00000000,B00100010,B00000000,
  B00001100,B00010000,B00000000,B11000001,B10000000,
  B00110000,B00001100,B00000001,B10000000,B01100000,
  B00000000,B00001011,B10001111,B10000000,B00000000,
  B00000000,B00011000,B01000000,B10000000,B00000000,
  B00000000,B00010000,B00100000,B01000000,B00000000,
  B00000000,B00100000,B00100000,B01000000,B00000000,
  B00000000,B00100000,B00100000,B00100000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000
};

const unsigned char clouds[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B01100000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000011,B11111100,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000111,B00001110,B00001111,B11000000,B00000000,B00000000,
  B00000000,B00001100,B00000011,B00011110,B11110000,B00000000,B00000000,
  B00000000,B00011000,B00000001,B11110000,B00011000,B00000000,B00000000,
  B00000000,B00010000,B00000000,B11000000,B00001100,B00000000,B00000000,
  B00000000,B01110000,B00000000,B10000000,B00000110,B00000000,B00000000,
  B00000001,B11100000,B00000001,B10000000,B00000011,B00000000,B00000000,
  B00000011,B00000000,B00000001,B00000000,B00000001,B00000000,B00000000,
  B00000110,B00000000,B00000011,B00000000,B00000001,B11110000,B00000000,
  B00000100,B00000000,B00000010,B00000000,B00000000,B10111000,B00000000,
  B00001100,B00000000,B01111110,B00000000,B00000000,B00001100,B00000000,
  B00001000,B00000000,B11100110,B00000000,B00000000,B00000100,B00000000,
  B00001000,B00000001,B10000000,B00000000,B00000000,B00000010,B00000000,
  B00001000,B00000011,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00000100,B00000010,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00001100,B00000100,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00011000,B00000100,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00010000,B00011100,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00010000,B01111100,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00110000,B11000000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00110001,B10000000,B00000000,B00000000,B00000000,B00000001,B00000000,
  B00110001,B00000000,B00000000,B00000000,B00000000,B00000001,B10000000,
  B00010011,B00000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00010010,B00000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00011010,B00000000,B00000000,B00000000,B00000000,B00000000,B11000000,
  B00001110,B00000000,B00000000,B00000000,B00000000,B00000000,B11000000,
  B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B11000000,
  B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00000001,B00000000,B00000000,B00000000,B00000000,B00000001,B10000000,
  B00000001,B10000000,B00000000,B00000000,B00000000,B00000001,B00000000,
  B00000000,B11000000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00000000,B01111111,B11111111,B11111111,B11111111,B11111110,B00000000,
  B00000000,B00011111,B11111111,B11111111,B11111111,B11111000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000
};


const unsigned char weather1[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00011111,B11000000,B00000000,
  B00000000,B00000000,B01100000,B01100000,B00000000,
  B00000000,B00000000,B10000000,B00010000,B00000000,
  B00000000,B00000001,B00000000,B00001000,B00000000,
  B00000000,B00000011,B00000000,B00000111,B00000000,
  B00000000,B00000010,B00000000,B00000000,B11000000,
  B00000000,B01111110,B00000000,B00000000,B01100000,
  B00000000,B10000000,B00000000,B00000000,B00110000,
  B00000001,B00000000,B00000000,B00000000,B00010000,
  B00000011,B00000000,B00000000,B00000000,B00010000,
  B00000110,B00000000,B00000000,B00000000,B00010000,
  B00011100,B00000000,B00000000,B00000000,B00010000,
  B00100000,B00000000,B00000000,B00000000,B00011000,
  B01000000,B00000000,B00000000,B00000000,B00001000,
  B01000000,B00000000,B00000000,B00000000,B00000100,
  B11000000,B00000000,B00000000,B00000000,B00000100,
  B01000000,B00000000,B00000000,B00000000,B00000100,
  B01000000,B00000000,B00000000,B00000000,B00001100,
  B01000000,B00000000,B00000000,B00000000,B00001000,
  B00100000,B00000000,B00000000,B00000000,B00010000,
  B00011111,B11111111,B11111111,B11111111,B11100000,
  B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000
};

const unsigned char cake[] PROGMEM = {
 0x00, 0x00, 0x10, 0x02, 0x00, 0x80, 0x70, 0x00, 0x00, 0x00, 0x18, 0x03, 0x00, 0xc0, 0x70, 0x00, 
  0x00, 0x07, 0x1c, 0x03, 0x80, 0xe0, 0x70, 0x00, 0x00, 0x07, 0x1e, 0x03, 0xc0, 0xf0, 0x07, 0x00, 
  0x0e, 0x07, 0x1f, 0x07, 0xc0, 0xf8, 0x07, 0x00, 0x0e, 0x00, 0x3f, 0x07, 0xe1, 0xf8, 0x07, 0x00, 
  0x0e, 0x00, 0x3f, 0x87, 0xe1, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x8e, 0xf1, 0xdc, 0x00, 0x00, 
  0x00, 0x38, 0x3f, 0x8f, 0xf1, 0xfc, 0x00, 0xe0, 0x00, 0x38, 0x3f, 0x8f, 0xf1, 0xfc, 0x00, 0xe0, 
  0x00, 0x38, 0x3f, 0x8f, 0xf1, 0xfc, 0x00, 0xe0, 0x00, 0x00, 0x1f, 0x87, 0xe0, 0xf8, 0x1c, 0x00, 
  0x00, 0x00, 0x3f, 0x87, 0xe1, 0xfc, 0x1c, 0x00, 0x00, 0x0e, 0x3f, 0x87, 0xe1, 0xfc, 0x1c, 0x00, 
  0x00, 0x0e, 0x3f, 0x87, 0xe1, 0xfc, 0x00, 0x00, 0x00, 0x0e, 0x3b, 0x86, 0x61, 0xdc, 0x00, 0x00, 
  0x00, 0x00, 0x3b, 0x86, 0x61, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x86, 0x61, 0xdc, 0x00, 0x00, 
  0x00, 0x00, 0x3b, 0x86, 0x61, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x86, 0x61, 0xdc, 0x00, 0x00, 
  0x00, 0x00, 0x3b, 0x86, 0x61, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x86, 0x61, 0xdc, 0x00, 0x00, 
  0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 
  0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x0e, 0x00, 0x0c, 0x00, 0x00, 0x70, 0x00, 
  0x00, 0x0e, 0x00, 0x0c, 0x38, 0x38, 0x70, 0x00, 0x00, 0x0e, 0x0e, 0x0c, 0x38, 0x38, 0x70, 0x00, 
  0x00, 0x0e, 0x0e, 0x00, 0x38, 0x38, 0x70, 0x00, 0x00, 0x0f, 0xf0, 0xfc, 0x3f, 0x0f, 0xf0, 0x00, 
  0x00, 0x0f, 0xf9, 0xfe, 0x7f, 0x9f, 0xf0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 
  0x00, 0x0f, 0x3f, 0xcf, 0xf3, 0xfc, 0xf0, 0x00, 0x00, 0x0e, 0x0f, 0x83, 0xc1, 0xf0, 0x70, 0x00, 
  0x00, 0x0e, 0x00, 0x00, 0x0f, 0xf7, 0x70, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x0f, 0xf7, 0x70, 0x00, 
  0x00, 0x0e, 0x00, 0x00, 0x0f, 0xf7, 0x70, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 
  0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 
  0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x03, 0x80, 0x07, 0x00, 0x00, 0xe0, 0x01, 0xc0, 
  0x03, 0x9c, 0x07, 0x00, 0xc0, 0xe0, 0x39, 0xc0, 0x03, 0x9c, 0x07, 0x00, 0xc0, 0xe0, 0x39, 0xc0, 
  0x03, 0x9c, 0x00, 0x00, 0xc0, 0x00, 0x39, 0xc0, 0x03, 0xc1, 0xf0, 0x7c, 0x3e, 0x0f, 0x83, 0xc0, 
  0x03, 0xe7, 0xf9, 0xfe, 0x7f, 0x9f, 0xe7, 0xc0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 
  0x03, 0xff, 0x3f, 0xcf, 0xf3, 0xfc, 0xff, 0xc0, 0x03, 0xfe, 0x1f, 0x87, 0xe1, 0xf8, 0x7f, 0xc0, 
  0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 
  0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x03, 0x80, 0x00, 0x00, 0x7f, 0xff, 0xdd, 0xc0, 
  0x03, 0x80, 0x00, 0x00, 0x7f, 0xff, 0xdd, 0xc0, 0x03, 0x80, 0x00, 0x00, 0x7f, 0xff, 0xdd, 0xc0, 
  0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 
  0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};

String main="";
String desc="";
float temp=0;
uint16_t pres=0;
uint8_t humidity=0;
float wind=0;
int tempF=0;

int tempMin1=100;
int tempMin2=100;
int tempMin3=100;
int tempMin4=100;
int tempMax1=0;
int tempMax2=0;
int tempMax3=0;
int tempMax4=0;
int humidity1=0;
int humidity2=0;
int humidity3=0;
int humidity4=0;
int cnt=0;
String date1="";
String date="";
String country="";


int getD=-1;
int getH=-1;
int getM=-1;
int getS=-1;
String fDate="";
String dayName="";
WiFiClient wifiClient;

// lagu
int length = 28; // the number of notes
char notes[] = "GGAGcB GGAGdc GGxecBA yyecdc";
int beats[] = { 2, 2, 8, 8, 8, 16, 1, 2, 2, 8, 8,8, 16, 1, 2,2,8,8,8,8,16, 1,2,2,8,8,8,16 };
int temporary = 150;

void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
  digitalWrite(Buzzer, HIGH);
  delayMicroseconds(tone);
  digitalWrite(Buzzer, LOW);
  delayMicroseconds(tone);
}
}

void playNote(char note, int duration) {
char names[] = {'C', 'D', 'E', 'F', 'G', 'A', 'B', 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'x', 'y' };
int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956,  834,  765,  593,  468,  346,  224, 655 , 715 };
int SPEE = 5;

// play the tone corresponding to the note name
for (int mus = 0; mus < 17; mus++) {
   if (names[mus] == note) {
    int newduration = duration/SPEE;
     playTone(tones[mus], newduration);
   }
}
}


void connectWifi() {
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  Serial.print("Connecting to ");
  Serial.println(WIFI_SSID);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected!");
  Serial.println(WiFi.localIP());
  Serial.println();
}

void initScreen()
{
  tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab
  //tft.setRotation(1);
  tft.fillScreen(ST7735_BLACK);
  //layout
    tft.drawFastHLine(0, 0, tft.width(), ST7735_WHITE);
    tft.drawFastHLine(1, 159, tft.width(), ST7735_WHITE);
    tft.drawFastVLine(0, 0, tft.height(), ST7735_WHITE);
    tft.drawFastVLine(127, 0, tft.height(), ST7735_WHITE);
    tft.drawFastHLine(1, 140, tft.width(), ST7735_WHITE);
    tft.drawFastHLine(1, 19, tft.width(), ST7735_WHITE);
  }

void hbd()
{
    tft.fillRect(0, 0, 128, 160, ST7735_BLACK);
    tft.drawRect(0, 0, 128, 160, ST7735_WHITE);
    tft.setFont(&FreeSansBold9pt7b);
    tft.setTextColor(ST7735_WHITE);
    tft.setCursor(34,20);
    tft.print("HAPPY");
    tft.setCursor(16,35);
    tft.print("BIRTHDAY");
    tft.setCursor(34,50);
    tft.print("CINDY");
    tft.drawBitmap(32, 60, cake, 64, 64, ST7735_WHITE);
    tft.fillRect(24, 135, 5, 14, ST7735_CYAN);
    tft.drawRect(24, 135, 80, 14, ST7735_WHITE);
    delay(100);
}

void setup() {
Serial.begin(9600);
delay(500);
pinMode(Buzzer, OUTPUT);
pinMode(Led, OUTPUT);
initScreen();
hbd();
connectWifi();
pinMode(Buzzer, OUTPUT);
tft.fillRect(24, 135, 20, 14, ST7735_CYAN);
    tft.drawRect(24, 135, 80, 14, ST7735_WHITE);
    delay(100);
    tft.fillRect(24, 135, 40, 14, ST7735_CYAN);
    tft.drawRect(24, 135, 80, 14, ST7735_WHITE);
    delay(100);
    tft.fillRect(24, 135, 80, 14, ST7735_CYAN);
    tft.drawRect(24, 135, 80, 14, ST7735_WHITE);
for (int mus = 0; mus < length; mus++) {
      if (notes[mus] == ' ') {
        delay(beats[mus] * temporary); // rest
        } else {
        playNote(notes[mus], beats[mus] * temporary);
      }
   // pause between notes
   delay(temporary);
}
timeClient.begin();
getTime();
getForecastData();
//delay(10000);
}

void loop() {
  // put your main code here, to run repeatedly:
getTime();
screen1();
digitalWrite(Led, HIGH);
delay(1000);
digitalWrite(Led, LOW);
delay(1000);
getCurrentData();
screen2();
digitalWrite(Led, HIGH);
delay(1000);
digitalWrite(Led, LOW);
delay(1000);
getForecastData();
screen3();
digitalWrite(Led, HIGH);
delay(1000);
digitalWrite(Led, LOW);
delay(1000);
}

void getTime()
{
  timeClient.update();
  getD=timeClient.getDay();
  getH=timeClient.getHours();
  getM=timeClient.getMinutes();
  getS=timeClient.getSeconds();
  fDate=timeClient.getFormattedTime();
  dayName=daysOfTheWeek[getD];
  Serial.print(getD);
  Serial.print(dayName);
  Serial.print(", ");
  Serial.print(getH);
  Serial.print(":");
  Serial.print(getM);
  Serial.print(":");
  Serial.println(getS);
  Serial.println(timeClient.getFormattedTime());
}

void getCurrentData()
{
  OpenWeatherMapCurrentData data;
  client.setLanguage(OPEN_WEATHER_MAP_LANGUAGE);
  client.setMetric(IS_METRIC);
  client.updateCurrent(&data, OPEN_WEATHER_MAP_APP_ID, OPEN_WEATHER_MAP_LOCATION);

  main=data.main.c_str();
  desc=data.description.c_str();
  temp=data.temp;
  tempF=(int)(temp);
  pres=data.pressure;
  humidity=data.humidity;
  wind=data.windSpeed;
  Serial.println("main: "+ main);
  Serial.println("description: "+ desc);
  Serial.printf("temp: %f\n", temp);
  Serial.printf("pressure: %d\n", pres);
  Serial.printf("humidity: %d\n", humidity);
  Serial.printf("windSpeed: %f\n", wind);
  
  }

  void getForecastData()
  {
    String serverPath = "http://api.openweathermap.org/data/2.5/forecast?q=" + OPEN_WEATHER_MAP_LOCATION + "&appid=" + OPEN_WEATHER_MAP_APP_ID + "&units=metric&lang=" + OPEN_WEATHER_MAP_LANGUAGE;
    String json = httpGETRequest(serverPath.c_str());
     //updateForecastData(json);
    tempMin1=100;
    tempMin2=100;
    tempMin3=100;
    tempMin4=100;
    tempMax1=0;
    tempMax2=0;
    tempMax3=0;
    tempMax4=0;
    humidity1=0;
    humidity2=0;
    humidity3=0;
    humidity4=0;
    int t=-1;
  t=json.indexOf("dt");
  json=json.substring(t+3,json.length());
  t=-1;
  t=json.indexOf("country");
  country=json.substring(t+10,t+12);
  t=-1;
  date1="";
  t=json.indexOf("dt_txt");
  date1=json.substring(t+9,t+19);
  if(cnt==0)
  {
    date=date1;
    cnt++;
    }
  int tc=json.substring(t+20,t+22).toInt();
  t=-1;
  tc=(((tc*(-1))+21)/3)+1;
  for(int i=0;i<tc;i++)
  {
    t=json.indexOf("dt_txt");
    String s=json.substring(0,t+31);
    json=json.substring(t+31,json.length());
    t=-1;
    t=s.indexOf("temp_min");
    int temp=s.substring(t+10,t+12).toInt();
    Serial.println(temp);
    if(tempMin1>temp)
    tempMin1=temp;
    t=-1;
    t=s.indexOf("temp_max");
    temp=s.substring(t+10,t+12).toInt();
    if(tempMax1<temp)
    tempMax1=temp;
    t=-1;
    t=s.indexOf("humidity");
    temp=s.substring(t+10,t+12).toInt();
    humidity1=humidity1+temp;
    t=-1;
    }
    humidity1=humidity1/tc;
    
    for(int i=0;i<8;i++)
    {
      t=json.indexOf("dt_txt");
    String s=json.substring(0,t+31);
    json=json.substring(t+31,json.length());
    t=-1;
    t=s.indexOf("temp_min");
    int temp=s.substring(t+10,t+12).toInt();
    if(tempMin2>temp)
    tempMin2=temp;
    t=-1;
    t=s.indexOf("temp_max");
    temp=s.substring(t+10,t+12).toInt();
    if(tempMax2<temp)
    tempMax2=temp;
    t=-1;
    t=s.indexOf("humidity");
    temp=s.substring(t+10,t+12).toInt();
    humidity2=humidity2+temp;
    t=-1;
      }
      humidity2=humidity2/8;
      
      for(int i=0;i<8;i++)
    {
      t=json.indexOf("dt_txt");
    String s=json.substring(0,t+31);
    json=json.substring(t+31,json.length());
    t=-1;
    t=s.indexOf("temp_min");
    int temp=s.substring(t+10,t+12).toInt();
    if(tempMin3>temp)
    tempMin3=temp;
    t=-1;
    t=s.indexOf("temp_max");
    temp=s.substring(t+10,t+12).toInt();
    if(tempMax3<temp)
    tempMax3=temp;
    t=-1;
    t=s.indexOf("humidity");
    temp=s.substring(t+10,t+12).toInt();
    humidity3=humidity3+temp;
    t=-1;
      }
      humidity3=humidity3/8;

      for(int i=0;i<8;i++)
    {
      t=json.indexOf("dt_txt");
    String s=json.substring(0,t+31);
    json=json.substring(t+31,json.length());
    t=-1;
    t=s.indexOf("temp_min");
    int temp=s.substring(t+10,t+12).toInt();
    if(tempMin4>temp)
    tempMin4=temp;
    t=-1;
    t=s.indexOf("temp_max");
    temp=s.substring(t+10,t+12).toInt();
    if(tempMax4<temp)
    tempMax4=temp;
    t=-1;
    t=s.indexOf("humidity");
    temp=s.substring(t+10,t+12).toInt();
    humidity4=humidity4+temp;
    t=-1;
      }
      humidity4=humidity4/8;

     
     json="";
     Serial.println(date1);
     Serial.println();
     //screen3();
     Serial.print("Today ");Serial.print("Min Temp - ");Serial.print(tempMin1);Serial.println(" Max Temp - ");Serial.print(tempMax1);Serial.println(" Humidity - ");Serial.println(humidity1);
     Serial.print("Tomorrow ");Serial.print("Min Temp - ");Serial.print(tempMin2);Serial.print(" Max Temp - ");Serial.print(tempMax2);Serial.print(" Humidity - ");Serial.println(humidity2);
     Serial.print("Day After Tomorrow ");Serial.print("Min Temp - ");Serial.print(tempMin3);Serial.print(" Max Temp - ");Serial.print(tempMax3);Serial.print(" Humidity - ");Serial.println(humidity3);
     Serial.print("Today + 3 ");Serial.print("Min Temp - ");Serial.print(tempMin4);Serial.print(" Max Temp - ");Serial.print(tempMax4);Serial.print(" Humidity - ");Serial.println(humidity4);
     
   
  }


    String httpGETRequest(const char* serverName) {
  HTTPClient http; 
  http.begin(serverName);
  
  int httpResponseCode = http.GET();
  
  String payload = "{}"; 
  
  if (httpResponseCode>0) {
    Serial.print("HTTP Response code: ");
    Serial.println(httpResponseCode);
    payload = http.getString();
  }
  else {
    Serial.print("Error code: ");
    Serial.println(httpResponseCode);
  }
  http.end();

  return payload;
}

void screen1()
{
        tft.fillScreen(ST7735_BLACK);
  //layout
    tft.drawFastHLine(0, 0, tft.width(), ST7735_WHITE);
    tft.drawFastHLine(1, 159, tft.width(), ST7735_WHITE);
    tft.drawFastVLine(0, 0, tft.height(), ST7735_WHITE);
    tft.drawFastVLine(127, 0, tft.height(), ST7735_WHITE);
    tft.drawFastHLine(1, 140, tft.width(), ST7735_WHITE);
    tft.drawFastHLine(1, 19, tft.width(), ST7735_WHITE);
      tft.setFont();
      tft.setTextColor(ST7735_WHITE);
      tft.setCursor(10,7);
      tft.print(OPEN_WEATHER_MAP_LOCATION);
      tft.setCursor(110,7);
      tft.print(country);
      tft.fillRect(3, 142 , 123, 16, ST7735_BLACK);
      tft.setCursor(10,146);
      if(getH<10)
      tft.print(0);
      tft.print(getH);
      tft.print(":");
      if(getM<10)
      tft.print(0);
      tft.print(getM);
      tft.setCursor(60,146);
      tft.print(date);
      tft.fillRect(3, 22 , 123, 116, ST7735_BLACK);
      tft.setFont(&FreeSansBold18pt7b);
      //tft.setTextColor(ST7735_WHITE);
      tft.setTextSize(1);
      tft.setCursor(22,60);
      tft.setTextColor(colors[2]);
      if(getH<10)
      tft.print(0);
      tft.print(getH);
      tft.print(":");
      if(getM<10)
      tft.print(0);
      tft.print(getM);
      tft.setFont(&FreeSans9pt7b);
      int daylen=0;
      daylen=dayName.length();
      if(daylen==6)
      tft.setCursor(35,90);
      else if (daylen==7)
      tft.setCursor(27,90);
      else if (daylen==8)
      tft.setCursor(21,90);
      else if (daylen==9)
      tft.setCursor(15,90);
      tft.setTextColor(colors[getD]);
      tft.print(dayName);
      tft.setTextColor(ST7735_WHITE);
      tft.setCursor(19,120);
      tft.print(date);
  }

  void screen2()
  {
    tft.fillRect(3, 22 , 123, 116, ST7735_BLACK);
    //tft.drawBitmap(8, 25, clouds, 51, 38,ST7735_WHITE);
    displayweatherbitmap_screen2();
  tft.setFont(&FreeSansBold9pt7b);
  tft.setTextColor(ST7735_WHITE);
  //tft.setTextColor(ST7735_WHITE);
      tft.setTextSize(1);
      tft.setCursor(2,80);
      tft.setTextColor(col);
      tft.print(main);
      tft.setCursor(64,50);
//      int range = map(tempF, 0, 60, 0, 6);
//      tft.setTextColor(colors[range]);
       if(tempF<=0)
       {
        tft.setTextColor(0x07FF);
        }
        else if(tempF>0 && tempF<5)
       {
        tft.setTextColor(0x03DF);
        }
        else if(tempF>6 && tempF<16)
       {
        tft.setTextColor(0x87E0);
        }
        else if(tempF>16 && tempF<27)
       {
        tft.setTextColor(0xFC00);
        }
        else if(tempF>27 && tempF<37)
       {
        tft.setTextColor(0xFA20);
        }
        else
       {
        tft.setTextColor(0xF800);
        }
      tft.print(tempF);
      tft.setFont();
      tft.setCursor(87,35);
      tft.print("C");
      
      tft.setTextColor(ST7735_WHITE);
      if(humidity<10)
      {
        tft.setTextColor(0x04E0);
        }
        else if(humidity<20 && humidity>10)
      {
        tft.setTextColor(0x87E0);
        }
        else if(humidity<30 && humidity>20)
      {
        tft.setTextColor(0xFFE0);
        }
        else if(humidity<40 && humidity>30)
      {
        tft.setTextColor(0xFB20);
        }
        else if(humidity>40)
      {
        tft.setTextColor(0xF800);
        }
      tft.setFont(&FreeSansBold9pt7b);
      tft.setCursor(94,50);
      tft.print(humidity);
      tft.setFont();
      tft.setCursor(118,35);
      tft.print("%");
      tft.setCursor(4,85);
      tft.setTextColor(col);
      String s=desc;
      String s1="";
      String s2="";
      if(s.length()>20)
      {
      char c[s.length()];
      s.toCharArray(c,s.length());
      for(int i=20;i>0;i--)
      {
        if(c[i]==' ')
        {
          s1=s.substring(0,i+1);
          int j=20-i;
          for(int k=0;k<j;k++)
          {
            s1=s1+" ";
            }
          s2=s.substring(i+1,s.length());
          break;
          }
        }
        s2=" "+s2;
        tft.print(s1+s2);
      }
      else
      {
        tft.print(s);
        }
      tft.setCursor(8,110);
      tft.setTextColor(0x87F0);
      tft.print("Pressure  WindSpeed");
      tft.setCursor(11,122);
      tft.print(pres);
      tft.print(" hpa");
      tft.setCursor(75,122);
      tft.print(wind);
      tft.print(" m/s");
      tft.setTextColor(ST7735_WHITE);
    }

    void screen3()
    {
      int day2=getD+1;
      if(day2>6)
      day2=day2-7;
      int day3=day2+1;
      if(day3>6)
      day3=day3-7;
      int day4=day3+1;
      if(day4>6)
      day4=day4-7;
      tft.fillRect(2, 22 , 124, 116, ST7735_BLACK);
      tft.drawBitmap(8, 28, weather1, 39, 24,colors[day2]);
    tft.drawBitmap(8, 68, weather1, 39, 24,colors[day3]);
    tft.drawBitmap(8, 108, weather1, 39, 24,colors[day4]);
      tft.setFont();
      tft.setTextColor(colors[day2]);
    tft.setCursor(65,25);
    tft.print(daysOfTheWeek[day2]);
    tft.setCursor(97,38);
    tft.print("C");
    tft.setCursor(105,44);
    tft.print(humidity2);
    tft.print("%");
    tft.setFont(&FreeSansBold9pt7b);
    tft.setCursor(50,50);
    tft.print(tempMin2);
    tft.print("/");
    tft.print(tempMax2);
    tft.setFont();
    tft.setTextColor(colors[day3]);
    tft.setCursor(65,65);
    tft.print(daysOfTheWeek[day3]);
    tft.setCursor(97,78);
    tft.print("C");
    tft.setCursor(105,84);
    tft.print(humidity3);
    tft.print("%");
    tft.setFont(&FreeSansBold9pt7b);
    tft.setCursor(50,90);
    tft.print(tempMin3);
    tft.print("/");
    tft.print(tempMax3);
    tft.setFont();
    tft.setTextColor(colors[day4]);
    tft.setCursor(65,105);
    tft.print(daysOfTheWeek[day4]);
    tft.setCursor(97,118);
    tft.print("C");
    tft.setCursor(105,124);
    tft.print(humidity4);
    tft.print("%");
    tft.setFont(&FreeSansBold9pt7b);
    tft.setCursor(50,130);
    tft.print(tempMin4);
    tft.print("/");
    tft.print(tempMax4);
      }

      void displayweatherbitmap_screen2()
      {
        if(main.equals("Clouds"))
        {
          col=0xFFE0;
          tft.drawBitmap(8, 25, clouds, 51, 38,0xFFE0);
          }
          else if(main.equals("Rain"))
        {
          col=0x07FF;
          tft.drawBitmap(8, 25, rain, 51, 40,0x07FF);
          }
          else if(main.equals("Thunderstorm"))
        {
          col=0x03DF;
          tft.drawBitmap(8, 25, thunder, 51, 40,0x03DF);
          }
          else if(main.equals("Clear"))
        {
          col=0xFFE0;
          tft.drawBitmap(8, 25, clearS1, 37, 40,0xFFE0);
          }
          else if(main.equals("Drizzle"))
        {
          col=0x07FF;
          tft.drawBitmap(8, 25, drizzle, 51, 40,0x07FF);
          }
          else if(main.equals("Snow"))
        {
          col=ST7735_WHITE;
          tft.drawBitmap(8, 25, snow, 51, 40,ST7735_WHITE);
          }
          else
        {
          col=0xD6D5;
          tft.drawBitmap(8, 25, mist, 51, 40,0xD6D5);
          }
        }

when i program my code to using Wifimanager insted of hard program the ssid the screen always become blank and repeat itselft. this is my code:

#include <Adafruit_GFX.h>      // include Adafruit graphics library
#include <Adafruit_ST7735.h>   // include Adafruit ST7735 TFT library
#include <ESP8266HTTPClient.h>
#include <WiFiManager.h>
#include <WiFiClient.h>
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <JsonListener.h>
#include <time.h>
#include "OpenWeatherMapCurrent.h"
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#include <Fonts/FreeMono12pt7b.h>
#include <Fonts/FreeSans9pt7b.h>
#include <Fonts/FreeSans12pt7b.h>
#include <Fonts/FreeSansBold18pt7b.h>
#include <Fonts/FreeSansBold9pt7b.h>

WiFiManager wifiManager;
OpenWeatherMapCurrent client;

// ST7735 TFT module connections
#define TFT_RST   D4     // TFT RST pin is connected to NodeMCU pin D4 (GPIO2)
#define TFT_CS    D3     // TFT CS  pin is connected to NodeMCU pin D4 (GPIO0)
#define TFT_DC    D2     // TFT DC  pin is connected to NodeMCU pin D4 (GPIO4)
#define Buzzer    D8
#define Led       D1

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);


String OPEN_WEATHER_MAP_APP_ID = "2bc3211721669d0ed3e9a3d846200c77";
String OPEN_WEATHER_MAP_LOCATION = "Surabaya";
String OPEN_WEATHER_MAP_LANGUAGE = "en";
boolean IS_METRIC = true;

const char* WIFI_SSID     = "Home";
const char* WIFI_PASSWORD = "12345678";

const long utcOffsetInSeconds = 25200;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "pool.ntp.org", utcOffsetInSeconds);
uint16_t colors[7]={0xF800, 0xFB20, 0xFFE0, 0x87E0, 0x04E0, 0x07FF, 0x03DF};
uint16_t col=0;
const unsigned char thunder[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00111110,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000001,B11100011,B11000000,B00000000,B00000000,
  B00000000,B00000000,B00000011,B00000000,B01100000,B00000000,B00000000,
  B00000000,B00000000,B00000100,B00000000,B00110000,B00000000,B00000000,
  B00000000,B00000000,B00001000,B00000000,B00011000,B00000000,B00000000,
  B00000000,B00000000,B00010000,B00000000,B00001100,B00000000,B00000000,
  B00000000,B00000000,B00110000,B00000000,B00000111,B11000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,B01100000,B00000000,
  B00000000,B00001111,B11100000,B00000000,B00000000,B00010000,B00000000,
  B00000000,B00011000,B00000000,B00000000,B00000000,B00011000,B00000000,
  B00000000,B00100000,B00000000,B00000000,B00000000,B00001000,B00000000,
  B00000000,B01100000,B00000000,B00000000,B00000000,B00001100,B00000000,
  B00000000,B01000000,B00000000,B00000000,B00000000,B00001100,B00000000,
  B00000000,B11000000,B00000000,B00000000,B00000000,B00001100,B00000000,
  B00001111,B10000000,B00000000,B00000100,B00000000,B00001000,B00000000,
  B00011000,B00000000,B00000000,B00000100,B00000000,B00001100,B00000000,
  B00110000,B00000000,B00000000,B00001100,B00000000,B00000110,B00000000,
  B00100000,B00000000,B00000000,B00001000,B00000000,B00000010,B00000000,
  B01100000,B00000000,B00000000,B00011000,B00000000,B00000011,B00000000,
  B01000000,B00000000,B00000000,B00010000,B00000000,B00000001,B00000000,
  B01000000,B00000000,B00010000,B00110000,B00000000,B00000001,B00000000,
  B01000000,B00000000,B00110000,B00100000,B00000000,B00000001,B00000000,
  B01100000,B00000000,B00100000,B00100000,B00000000,B00000011,B00000000,
  B00100000,B00000000,B01100000,B01111111,B10000000,B00000010,B00000000,
  B00010000,B00000000,B01000000,B01111111,B10000000,B00000110,B00000000,
  B00011100,B00000000,B01111000,B00000001,B00000000,B00011100,B00000000,
  B00000111,B11111100,B00001000,B00000011,B00111111,B11110000,B00000000,
  B00000000,B00000000,B00011000,B00000010,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00010000,B00000010,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00110000,B00000100,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000100,B00000000,B00000000,B00000000,
  B00000000,B00000000,B01100000,B00001100,B00000000,B00000000,B00000000,
  B00000000,B00000000,B01000000,B00001000,B00000000,B00000000,B00000000,
  B00010000,B00000110,B00000000,B10000000,B00010000,B00000100,B00000000,
  B00110000,B00000100,B00000001,B10000000,B00100000,B00000100,B00000000,
  B00100000,B00001100,B00000001,B00000000,B00100000,B00001100,B00000000,
  B01100000,B00001000,B00000001,B00000000,B01100000,B00001000,B00000000,
  B01000000,B00001000,B00000011,B00000000,B01000000,B00011000,B00000000,
  B01000000,B00000000,B00000010,B00000000,B01000000,B00010000,B00000000
};


const unsigned char drizzle[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01111111,B11000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B11100000,B11100000,B00000000,B00000000,
  B00000000,B00000000,B00000011,B10000000,B00111000,B00000000,B00000000,
  B00000000,B00000000,B00000110,B00000000,B00001100,B00000000,B00000000,
  B00000000,B00000000,B00000100,B00000000,B00000110,B00000000,B00000000,
  B00000000,B00000000,B00001100,B00000000,B00000010,B00000000,B00000000,
  B00000000,B00000000,B00011000,B00000000,B00000011,B11100000,B00000000,
  B00000000,B00000000,B00010000,B00000000,B00000001,B11111000,B00000000,
  B00000000,B00000011,B11110000,B00000000,B00000000,B00001100,B00000000,
  B00000000,B00001110,B01110000,B00000000,B00000000,B00000110,B00000000,
  B00000000,B00011000,B00000000,B00000000,B00000000,B00000110,B00000000,
  B00000000,B00100000,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00000000,B01100000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00000000,B01000000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00000000,B11000000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00000111,B11000000,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00011100,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00010000,B00000000,B00000000,B00000000,B00000000,B00000001,B00000000,
  B00100000,B00000000,B00000000,B00000000,B00000000,B00000001,B10000000,
  B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B11000000,
  B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11000000,
  B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000000,
  B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000000,
  B01000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000000,
  B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B11000000,
  B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00110000,B00000000,B00000000,B00000000,B00000000,B00000001,B10000000,
  B00011000,B00000000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00001110,B00000000,B00000000,B00000000,B00000000,B00001110,B00000000,
  B00000111,B11111111,B11111111,B11111111,B11111111,B11111100,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B11000000,B00110000,B00001100,B00000011,B00000000,B00000000,
  B00000000,B11000000,B00100000,B00001000,B00000010,B00000000,B00000000,
  B00000000,B10000000,B00100000,B00011000,B00000110,B00000000,B00000000,
  B00000001,B10000000,B01100000,B00010000,B00000100,B00000000,B00000000,
  B00000001,B00000000,B01000000,B00110000,B00000100,B00000000,B00000000,
  B00000001,B00000000,B01000000,B00110000,B00001100,B00000000,B00000000
};


const unsigned char rain[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B11111110,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000011,B00000001,B10001111,B11110000,B00000000,B00000000,
  B00000000,B00000110,B00000000,B11110000,B00001100,B00000000,B00000000,
  B00000000,B00001100,B00000000,B01000000,B00000110,B00000000,B00000000,
  B00000000,B01111000,B00000000,B10000000,B00000011,B00000000,B00000000,
  B00000001,B10000000,B00000001,B10000000,B00000001,B11100000,B00000000,
  B00000001,B00000000,B00000001,B00000000,B00000000,B00011000,B00000000,
  B00000001,B00000000,B01111111,B00000000,B00000000,B00001100,B00000000,
  B00000001,B00000000,B11000000,B00000000,B00000000,B00000110,B00000000,
  B00000001,B00000001,B10000000,B00000000,B00000000,B00000010,B00000000,
  B00000011,B00000001,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00000110,B00000111,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00000100,B00111000,B00000000,B00000000,B00000000,B00000110,B00000000,
  B00000100,B01100000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00000100,B01000000,B00000000,B00000000,B00000000,B00000001,B00000000,
  B00000110,B11000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00000011,B10000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00000001,B10000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00000000,B01000000,B00000000,B00000000,B00000000,B00000001,B10000000,
  B00000000,B01000000,B00000000,B00000000,B00000000,B00000001,B00000000,
  B00000000,B00100000,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00000000,B00011111,B11111111,B11111111,B11111111,B11111100,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000010,B00000001,B00000000,B10000000,B01000000,B00110000,B00000000,
  B00000100,B00000010,B00000001,B10000000,B01000000,B00100000,B00000000,
  B00000100,B00000010,B00000001,B00000000,B10000000,B01100000,B00000000,
  B00001000,B00000100,B00000011,B00000000,B10000000,B01000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000001,B00000000,B00000000,
  B00100000,B00010000,B00001000,B00000110,B00000001,B00000000,B00000000,
  B01100000,B00110000,B00001000,B00000100,B00000010,B00000000,B00000000,
  B01000000,B00100000,B00010000,B00001100,B00000010,B00000000,B00000000,
  B11000000,B01100000,B00010000,B00001000,B00000100,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000
};

const unsigned char snow[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00100000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00100000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00100000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00010000,B00100000,B01000000,B00000000,B00000000,
  B00000000,B00000000,B00011000,B00100000,B11000000,B00000000,B00000000,
  B00000000,B00000000,B00000110,B00100001,B10000000,B00000000,B00000000,
  B00000000,B00000000,B00000011,B00100110,B00000000,B00000000,B00000000,
  B00000000,B00100000,B00000000,B10101100,B00000000,B00100000,B00000000,
  B00000000,B00010000,B00000000,B01110000,B00000000,B01100000,B00000000,
  B00000000,B00010000,B00000000,B00100000,B00000000,B01000000,B00000000,
  B00011100,B00011000,B00000000,B00100000,B00000000,B11000001,B11000000,
  B00000011,B00001000,B00000000,B01110000,B00000000,B10000111,B00000000,
  B00000000,B11101100,B00000000,B11111000,B00000000,B10111000,B00000000,
  B00000000,B00011100,B00000011,B00100110,B00000001,B11000000,B00000000,
  B00000000,B11111111,B11111100,B00100001,B11111111,B11111000,B00000000,
  B00011111,B00000001,B11100000,B00100000,B00111100,B00000111,B11000000,
  B00000000,B00000000,B11011000,B00100000,B11111000,B00000000,B00000000,
  B00000000,B00000000,B01000111,B00100011,B00011000,B00000000,B00000000,
  B00000000,B00000000,B01000001,B11111100,B00010000,B00000000,B00000000,
  B00000000,B00000000,B01000000,B01111000,B00010000,B00000000,B00000000,
  B00000000,B00000000,B01000011,B10100110,B00010000,B00000000,B00000000,
  B00000000,B00000000,B11011100,B00100001,B11011000,B00000000,B00000000,
  B00011100,B00000000,B11100000,B00100000,B00111100,B00000001,B11000000,
  B00000011,B11110011,B11111000,B00100000,B11111110,B01111110,B00000000,
  B00000000,B00011110,B00000111,B00100011,B10000001,B11000000,B00000000,
  B00000000,B01111100,B00000001,B10101100,B00000001,B10110000,B00000000,
  B00000001,B10001000,B00000000,B01111000,B00000000,B10001110,B00000000,
  B00001110,B00001000,B00000000,B00110000,B00000000,B11000011,B10000000,
  B00010000,B00011000,B00000000,B00100000,B00000000,B01000000,B00000000,
  B00000000,B00010000,B00000000,B01110000,B00000000,B01100000,B00000000,
  B00000000,B00110000,B00000000,B11111000,B00000000,B00100000,B00000000,
  B00000000,B00100000,B00000001,B10100110,B00000000,B00100000,B00000000,
  B00000000,B00000000,B00000110,B00100011,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00001100,B00100001,B10000000,B00000000,B00000000,
  B00000000,B00000000,B00010000,B00100000,B01100000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00100000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00100000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000
};

const unsigned char mist[] PROGMEM = {
  B00000000,B00000000,B00000011,B11111000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00001111,B11111111,B10000000,B00000000,B00000000,
  B00000000,B00000000,B00111000,B00000011,B11000000,B00000000,B00000000,
  B00000000,B00000000,B01110000,B00000000,B01100000,B00000000,B00000000,
  B00000000,B00000000,B11000000,B00000000,B00111000,B00000000,B00000000,
  B00000000,B00000011,B10000000,B00000000,B00011111,B11110000,B00000000,
  B00000000,B00000011,B00000000,B00000000,B00011111,B11111110,B00000000,
  B00000000,B00000111,B00000000,B00000000,B00000000,B00001111,B00000000,
  B00000000,B11111111,B11000000,B00000000,B00000000,B00000001,B11000000,
  B00000111,B11000000,B11111000,B00000000,B00000000,B00000001,B11000000,
  B00001111,B00000000,B00111100,B00000000,B00000000,B00000000,B11100000,
  B00011000,B00000000,B00001111,B00000000,B00000000,B00000000,B11100000,
  B01110000,B00000000,B00000111,B10111100,B00000000,B00000000,B11100000,
  B01110000,B00000000,B00000011,B11111111,B11000000,B00000000,B11100000,
  B01100000,B00000000,B00000000,B10000001,B11100000,B00000000,B11100000,
  B11100000,B00000000,B00000000,B00000000,B00111000,B00000000,B11100000,
  B11100000,B00000000,B00000000,B00000000,B00011000,B00000000,B11000000,
  B11100000,B00000000,B00000000,B00000000,B00011100,B00000001,B11000000,
  B11100000,B00000000,B00000000,B00000000,B00011100,B00000011,B00000000,
  B11100000,B00000000,B00000000,B00000000,B00000100,B00011110,B00000000,
  B11100000,B00000000,B00000000,B00000000,B00000111,B11111100,B00000000,
  B01100000,B00000000,B00000000,B00000000,B00000111,B11000000,B00000000,
  B01110000,B00000000,B00000000,B00000000,B00011100,B00000000,B00000000,
  B00011000,B00000000,B00000000,B00000000,B00011100,B00000000,B00000000,
  B00011110,B00000000,B00000000,B00000000,B00111000,B00000000,B00000000,
  B00001111,B00000000,B00000000,B00000000,B01100000,B00000000,B00000000,
  B00000001,B11000000,B00000000,B00000011,B11000000,B00000000,B00000000,
  B00000000,B11111111,B11111111,B11111111,B10000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B11000011,B11110000,B11111001,B11111000,B01100000,B00000000,
  B00000000,B11111111,B11111111,B10111111,B11111111,B11100000,B00000000,
  B00000000,B00111100,B00001111,B00011110,B00000111,B10000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B11000011,B11110000,B11111001,B11111000,B01100000,B00000000,
  B00000000,B11111111,B11111111,B10111111,B11111111,B11100000,B00000000,
  B00000000,B00111100,B00001111,B00011110,B00000111,B10000000,B00000000
};

const unsigned char clearS[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000110,B00000000,B01000000,B00001100,B00000000,B00000000,
  B00000000,B00000011,B00000000,B01000000,B00011000,B00000000,B00000000,
  B00000000,B00000001,B00000000,B01000000,B00010000,B00000000,B00000000,
  B00000000,B00000000,B10000000,B10100000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B01011111,B00011111,B01000000,B00000000,B00000000,
  B00111000,B00000000,B01100000,B00000000,B11100000,B00000001,B10000000,
  B00000110,B00000001,B10000000,B00000000,B00011000,B00001100,B00000000,
  B00000001,B11000110,B00000000,B00000000,B00001100,B01110000,B00000000,
  B00000000,B00101100,B00000000,B00000000,B00000110,B11000000,B00000000,
  B00000000,B00001000,B00000000,B00000000,B00000011,B00000000,B00000000,
  B00000000,B00010000,B00000000,B00000000,B00000001,B00000000,B00000000,
  B00000000,B00110000,B00000000,B00000000,B00000001,B10000000,B00000000,
  B00000000,B00100000,B00000000,B00000000,B00000000,B10000000,B00000000,
  B00000000,B00100000,B00000000,B00000000,B00000000,B10000000,B00000000,
  B00111111,B11100000,B00000000,B00000000,B00000000,B11111111,B11000000,
  B00000000,B00100000,B00000000,B00000000,B00000000,B10000000,B00000000,
  B00000000,B00100000,B00000000,B00000000,B00000000,B10000000,B00000000,
  B00000000,B00110000,B00000000,B00000000,B00000001,B10000000,B00000000,
  B00000000,B00010000,B00000000,B00000000,B00000001,B00000000,B00000000,
  B00000000,B00001000,B00000000,B00000000,B00000011,B00000000,B00000000,
  B00000000,B01101100,B00000000,B00000000,B00000110,B11000000,B00000000,
  B00000001,B11000110,B00000000,B00000000,B00001100,B01110000,B00000000,
  B00001110,B00000001,B10000000,B00000000,B00110000,B00001110,B00000000,
  B00110000,B00000000,B01100000,B00000000,B11000000,B00000001,B10000000,
  B00000000,B00000000,B01011111,B00011111,B01100000,B00000000,B00000000,
  B00000000,B00000000,B10000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000001,B00000000,B01000000,B00010000,B00000000,B00000000,
  B00000000,B00000011,B00000000,B01000000,B00001000,B00000000,B00000000,
  B00000000,B00000110,B00000000,B01000000,B00001100,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B01000000,B00000000,B00000000,B00000000
};

const unsigned char clearS1[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00100000,B00100000,B00100000,B00000000,
  B00000000,B00100000,B00100000,B01000000,B00000000,
  B00000000,B00010000,B00100000,B01000000,B00000000,
  B00000000,B00001000,B01110000,B10000000,B00000000,
  B00000000,B00001011,B10001111,B10000000,B00000000,
  B00110000,B00001100,B00000001,B10000000,B01100000,
  B00001100,B00010000,B00000000,B11000001,B10000000,
  B00000110,B00100000,B00000000,B00100110,B00000000,
  B00000001,B01000000,B00000000,B00111100,B00000000,
  B00000000,B01000000,B00000000,B00010000,B00000000,
  B00000000,B10000000,B00000000,B00001000,B00000000,
  B00000000,B10000000,B00000000,B00001000,B00000000,
  B00000000,B10000000,B00000000,B00001000,B00000000,
  B00000001,B00000000,B00000000,B00001000,B00000000,
  B00111111,B00000000,B00000000,B00001111,B11100000,
  B00000001,B00000000,B00000000,B00001000,B00000000,
  B00000000,B10000000,B00000000,B00001000,B00000000,
  B00000000,B10000000,B00000000,B00001000,B00000000,
  B00000000,B10000000,B00000000,B00001000,B00000000,
  B00000000,B01000000,B00000000,B00010000,B00000000,
  B00000001,B01000000,B00000000,B00111100,B00000000,
  B00000110,B00100000,B00000000,B00100010,B00000000,
  B00001100,B00010000,B00000000,B11000001,B10000000,
  B00110000,B00001100,B00000001,B10000000,B01100000,
  B00000000,B00001011,B10001111,B10000000,B00000000,
  B00000000,B00011000,B01000000,B10000000,B00000000,
  B00000000,B00010000,B00100000,B01000000,B00000000,
  B00000000,B00100000,B00100000,B01000000,B00000000,
  B00000000,B00100000,B00100000,B00100000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000,
  B00000000,B00000000,B00100000,B00000000,B00000000
};

const unsigned char clouds[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B01100000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000011,B11111100,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000111,B00001110,B00001111,B11000000,B00000000,B00000000,
  B00000000,B00001100,B00000011,B00011110,B11110000,B00000000,B00000000,
  B00000000,B00011000,B00000001,B11110000,B00011000,B00000000,B00000000,
  B00000000,B00010000,B00000000,B11000000,B00001100,B00000000,B00000000,
  B00000000,B01110000,B00000000,B10000000,B00000110,B00000000,B00000000,
  B00000001,B11100000,B00000001,B10000000,B00000011,B00000000,B00000000,
  B00000011,B00000000,B00000001,B00000000,B00000001,B00000000,B00000000,
  B00000110,B00000000,B00000011,B00000000,B00000001,B11110000,B00000000,
  B00000100,B00000000,B00000010,B00000000,B00000000,B10111000,B00000000,
  B00001100,B00000000,B01111110,B00000000,B00000000,B00001100,B00000000,
  B00001000,B00000000,B11100110,B00000000,B00000000,B00000100,B00000000,
  B00001000,B00000001,B10000000,B00000000,B00000000,B00000010,B00000000,
  B00001000,B00000011,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00000100,B00000010,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00001100,B00000100,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00011000,B00000100,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00010000,B00011100,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00010000,B01111100,B00000000,B00000000,B00000000,B00000010,B00000000,
  B00110000,B11000000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00110001,B10000000,B00000000,B00000000,B00000000,B00000001,B00000000,
  B00110001,B00000000,B00000000,B00000000,B00000000,B00000001,B10000000,
  B00010011,B00000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00010010,B00000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00011010,B00000000,B00000000,B00000000,B00000000,B00000000,B11000000,
  B00001110,B00000000,B00000000,B00000000,B00000000,B00000000,B11000000,
  B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B11000000,
  B00000010,B00000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00000011,B00000000,B00000000,B00000000,B00000000,B00000000,B10000000,
  B00000001,B00000000,B00000000,B00000000,B00000000,B00000001,B10000000,
  B00000001,B10000000,B00000000,B00000000,B00000000,B00000001,B00000000,
  B00000000,B11000000,B00000000,B00000000,B00000000,B00000011,B00000000,
  B00000000,B01111111,B11111111,B11111111,B11111111,B11111110,B00000000,
  B00000000,B00011111,B11111111,B11111111,B11111111,B11111000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000
};


const unsigned char weather1[] PROGMEM = {
  B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00011111,B11000000,B00000000,
  B00000000,B00000000,B01100000,B01100000,B00000000,
  B00000000,B00000000,B10000000,B00010000,B00000000,
  B00000000,B00000001,B00000000,B00001000,B00000000,
  B00000000,B00000011,B00000000,B00000111,B00000000,
  B00000000,B00000010,B00000000,B00000000,B11000000,
  B00000000,B01111110,B00000000,B00000000,B01100000,
  B00000000,B10000000,B00000000,B00000000,B00110000,
  B00000001,B00000000,B00000000,B00000000,B00010000,
  B00000011,B00000000,B00000000,B00000000,B00010000,
  B00000110,B00000000,B00000000,B00000000,B00010000,
  B00011100,B00000000,B00000000,B00000000,B00010000,
  B00100000,B00000000,B00000000,B00000000,B00011000,
  B01000000,B00000000,B00000000,B00000000,B00001000,
  B01000000,B00000000,B00000000,B00000000,B00000100,
  B11000000,B00000000,B00000000,B00000000,B00000100,
  B01000000,B00000000,B00000000,B00000000,B00000100,
  B01000000,B00000000,B00000000,B00000000,B00001100,
  B01000000,B00000000,B00000000,B00000000,B00001000,
  B00100000,B00000000,B00000000,B00000000,B00010000,
  B00011111,B11111111,B11111111,B11111111,B11100000,
  B00000000,B00000000,B00000000,B00000000,B00000000,
  B00000000,B00000000,B00000000,B00000000,B00000000
};

const unsigned char cake[] PROGMEM = {
 0x00, 0x00, 0x10, 0x02, 0x00, 0x80, 0x70, 0x00, 0x00, 0x00, 0x18, 0x03, 0x00, 0xc0, 0x70, 0x00, 
  0x00, 0x07, 0x1c, 0x03, 0x80, 0xe0, 0x70, 0x00, 0x00, 0x07, 0x1e, 0x03, 0xc0, 0xf0, 0x07, 0x00, 
  0x0e, 0x07, 0x1f, 0x07, 0xc0, 0xf8, 0x07, 0x00, 0x0e, 0x00, 0x3f, 0x07, 0xe1, 0xf8, 0x07, 0x00, 
  0x0e, 0x00, 0x3f, 0x87, 0xe1, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x8e, 0xf1, 0xdc, 0x00, 0x00, 
  0x00, 0x38, 0x3f, 0x8f, 0xf1, 0xfc, 0x00, 0xe0, 0x00, 0x38, 0x3f, 0x8f, 0xf1, 0xfc, 0x00, 0xe0, 
  0x00, 0x38, 0x3f, 0x8f, 0xf1, 0xfc, 0x00, 0xe0, 0x00, 0x00, 0x1f, 0x87, 0xe0, 0xf8, 0x1c, 0x00, 
  0x00, 0x00, 0x3f, 0x87, 0xe1, 0xfc, 0x1c, 0x00, 0x00, 0x0e, 0x3f, 0x87, 0xe1, 0xfc, 0x1c, 0x00, 
  0x00, 0x0e, 0x3f, 0x87, 0xe1, 0xfc, 0x00, 0x00, 0x00, 0x0e, 0x3b, 0x86, 0x61, 0xdc, 0x00, 0x00, 
  0x00, 0x00, 0x3b, 0x86, 0x61, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x86, 0x61, 0xdc, 0x00, 0x00, 
  0x00, 0x00, 0x3b, 0x86, 0x61, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x86, 0x61, 0xdc, 0x00, 0x00, 
  0x00, 0x00, 0x3b, 0x86, 0x61, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x86, 0x61, 0xdc, 0x00, 0x00, 
  0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 
  0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x0e, 0x00, 0x0c, 0x00, 0x00, 0x70, 0x00, 
  0x00, 0x0e, 0x00, 0x0c, 0x38, 0x38, 0x70, 0x00, 0x00, 0x0e, 0x0e, 0x0c, 0x38, 0x38, 0x70, 0x00, 
  0x00, 0x0e, 0x0e, 0x00, 0x38, 0x38, 0x70, 0x00, 0x00, 0x0f, 0xf0, 0xfc, 0x3f, 0x0f, 0xf0, 0x00, 
  0x00, 0x0f, 0xf9, 0xfe, 0x7f, 0x9f, 0xf0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 
  0x00, 0x0f, 0x3f, 0xcf, 0xf3, 0xfc, 0xf0, 0x00, 0x00, 0x0e, 0x0f, 0x83, 0xc1, 0xf0, 0x70, 0x00, 
  0x00, 0x0e, 0x00, 0x00, 0x0f, 0xf7, 0x70, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x0f, 0xf7, 0x70, 0x00, 
  0x00, 0x0e, 0x00, 0x00, 0x0f, 0xf7, 0x70, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 
  0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 
  0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x03, 0x80, 0x07, 0x00, 0x00, 0xe0, 0x01, 0xc0, 
  0x03, 0x9c, 0x07, 0x00, 0xc0, 0xe0, 0x39, 0xc0, 0x03, 0x9c, 0x07, 0x00, 0xc0, 0xe0, 0x39, 0xc0, 
  0x03, 0x9c, 0x00, 0x00, 0xc0, 0x00, 0x39, 0xc0, 0x03, 0xc1, 0xf0, 0x7c, 0x3e, 0x0f, 0x83, 0xc0, 
  0x03, 0xe7, 0xf9, 0xfe, 0x7f, 0x9f, 0xe7, 0xc0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 
  0x03, 0xff, 0x3f, 0xcf, 0xf3, 0xfc, 0xff, 0xc0, 0x03, 0xfe, 0x1f, 0x87, 0xe1, 0xf8, 0x7f, 0xc0, 
  0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 
  0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x03, 0x80, 0x00, 0x00, 0x7f, 0xff, 0xdd, 0xc0, 
  0x03, 0x80, 0x00, 0x00, 0x7f, 0xff, 0xdd, 0xc0, 0x03, 0x80, 0x00, 0x00, 0x7f, 0xff, 0xdd, 0xc0, 
  0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 
  0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};

String main="";
String desc="";
float temp=0;
uint16_t pres=0;
uint8_t humidity=0;
float wind=0;
int tempF=0;

int tempMin1=100;
int tempMin2=100;
int tempMin3=100;
int tempMin4=100;
int tempMax1=0;
int tempMax2=0;
int tempMax3=0;
int tempMax4=0;
int humidity1=0;
int humidity2=0;
int humidity3=0;
int humidity4=0;
int cnt=0;
String date1="";
String date="";
String country="";


int getD=-1;
int getH=-1;
int getM=-1;
int getS=-1;
String fDate="";
String dayName="";
WiFiClient wifiClient;

// lagu
int length = 28; // the number of notes
char notes[] = "GGAGcB GGAGdc GGxecBA yyecdc";
int beats[] = { 2, 2, 8, 8, 8, 16, 1, 2, 2, 8, 8,8, 16, 1, 2,2,8,8,8,8,16, 1,2,2,8,8,8,16 };
int temporary = 150;

void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
  digitalWrite(Buzzer, HIGH);
  delayMicroseconds(tone);
  digitalWrite(Buzzer, LOW);
  delayMicroseconds(tone);
}
}

void playNote(char note, int duration) {
char names[] = {'C', 'D', 'E', 'F', 'G', 'A', 'B', 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'x', 'y' };
int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956,  834,  765,  593,  468,  346,  224, 655 , 715 };
int SPEE = 5;

// play the tone corresponding to the note name
for (int mus = 0; mus < 17; mus++) {
   if (names[mus] == note) {
    int newduration = duration/SPEE;
     playTone(tones[mus], newduration);
   }
}
}


void initScreen()
{
  tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab
  //tft.setRotation(1);
  tft.fillScreen(ST7735_BLACK);
  //layout
    tft.drawFastHLine(0, 0, tft.width(), ST7735_WHITE);
    tft.drawFastHLine(1, 159, tft.width(), ST7735_WHITE);
    tft.drawFastVLine(0, 0, tft.height(), ST7735_WHITE);
    tft.drawFastVLine(127, 0, tft.height(), ST7735_WHITE);
    tft.drawFastHLine(1, 140, tft.width(), ST7735_WHITE);
    tft.drawFastHLine(1, 19, tft.width(), ST7735_WHITE);
  }

void hbd()
{
    tft.fillRect(0, 0, 128, 160, ST7735_BLACK);
    tft.drawRect(0, 0, 128, 160, ST7735_WHITE);
    tft.setFont(&FreeSansBold9pt7b);
    tft.setTextColor(ST7735_WHITE);
    tft.setCursor(34,20);
    tft.print("HAPPY");
    tft.setCursor(16,35);
    tft.print("BIRTHDAY");
    tft.setCursor(34,50);
    tft.print("CINDY");
    tft.drawBitmap(32, 60, cake, 64, 64, ST7735_WHITE);
    tft.fillRect(24, 135, 5, 14, ST7735_CYAN);
    tft.drawRect(24, 135, 80, 14, ST7735_WHITE);
    delay(100);
}

void setup() {
Serial.begin(9600);
delay(500);
pinMode(Buzzer, OUTPUT);
pinMode(Led, OUTPUT);
initScreen();
hbd();
wifiManager.autoConnect("SatelitAyangCindy", "12345678");
Serial.println("Connected to WiFi");
tft.fillRect(24, 135, 20, 14, ST7735_CYAN);
    tft.drawRect(24, 135, 80, 14, ST7735_WHITE);
    delay(100);
    tft.fillRect(24, 135, 40, 14, ST7735_CYAN);
    tft.drawRect(24, 135, 80, 14, ST7735_WHITE);
    delay(100);
    tft.fillRect(24, 135, 80, 14, ST7735_CYAN);
    tft.drawRect(24, 135, 80, 14, ST7735_WHITE);
for (int mus = 0; mus < length; mus++) {
      if (notes[mus] == ' ') {
        delay(beats[mus] * temporary); // rest
        } else {
        playNote(notes[mus], beats[mus] * temporary);
      }
   // pause between notes
   delay(temporary);
}
timeClient.begin();
getTime();
getForecastData();
//delay(10000);
}

void loop() {
  // put your main code here, to run repeatedly:
getTime();
screen1();
digitalWrite(Led, HIGH);
delay(1000);
digitalWrite(Led, LOW);
delay(1000);
getCurrentData();
screen2();
digitalWrite(Led, HIGH);
delay(1000);
digitalWrite(Led, LOW);
delay(1000);
getForecastData();
screen3();
digitalWrite(Led, HIGH);
delay(1000);
digitalWrite(Led, LOW);
delay(1000);
}

void getTime()
{
  timeClient.update();
  getD=timeClient.getDay();
  getH=timeClient.getHours();
  getM=timeClient.getMinutes();
  getS=timeClient.getSeconds();
  fDate=timeClient.getFormattedTime();
  dayName=daysOfTheWeek[getD];
  Serial.print(getD);
  Serial.print(dayName);
  Serial.print(", ");
  Serial.print(getH);
  Serial.print(":");
  Serial.print(getM);
  Serial.print(":");
  Serial.println(getS);
  Serial.println(timeClient.getFormattedTime());
}

void getCurrentData()
{
  OpenWeatherMapCurrentData data;
  client.setLanguage(OPEN_WEATHER_MAP_LANGUAGE);
  client.setMetric(IS_METRIC);
  client.updateCurrent(&data, OPEN_WEATHER_MAP_APP_ID, OPEN_WEATHER_MAP_LOCATION);

  main=data.main.c_str();
  desc=data.description.c_str();
  temp=data.temp;
  tempF=(int)(temp);
  pres=data.pressure;
  humidity=data.humidity;
  wind=data.windSpeed;
  Serial.println("main: "+ main);
  Serial.println("description: "+ desc);
  Serial.printf("temp: %f\n", temp);
  Serial.printf("pressure: %d\n", pres);
  Serial.printf("humidity: %d\n", humidity);
  Serial.printf("windSpeed: %f\n", wind);
  
  }

  void getForecastData()
  {
    String serverPath = "http://api.openweathermap.org/data/2.5/forecast?q=" + OPEN_WEATHER_MAP_LOCATION + "&appid=" + OPEN_WEATHER_MAP_APP_ID + "&units=metric&lang=" + OPEN_WEATHER_MAP_LANGUAGE;
    String json = httpGETRequest(serverPath.c_str());
     //updateForecastData(json);
    tempMin1=100;
    tempMin2=100;
    tempMin3=100;
    tempMin4=100;
    tempMax1=0;
    tempMax2=0;
    tempMax3=0;
    tempMax4=0;
    humidity1=0;
    humidity2=0;
    humidity3=0;
    humidity4=0;
    int t=-1;
  t=json.indexOf("dt");
  json=json.substring(t+3,json.length());
  t=-1;
  t=json.indexOf("country");
  country=json.substring(t+10,t+12);
  t=-1;
  date1="";
  t=json.indexOf("dt_txt");
  date1=json.substring(t+9,t+19);
  if(cnt==0)
  {
    date=date1;
    cnt++;
    }
  int tc=json.substring(t+20,t+22).toInt();
  t=-1;
  tc=(((tc*(-1))+21)/3)+1;
  for(int i=0;i<tc;i++)
  {
    t=json.indexOf("dt_txt");
    String s=json.substring(0,t+31);
    json=json.substring(t+31,json.length());
    t=-1;
    t=s.indexOf("temp_min");
    int temp=s.substring(t+10,t+12).toInt();
    Serial.println(temp);
    if(tempMin1>temp)
    tempMin1=temp;
    t=-1;
    t=s.indexOf("temp_max");
    temp=s.substring(t+10,t+12).toInt();
    if(tempMax1<temp)
    tempMax1=temp;
    t=-1;
    t=s.indexOf("humidity");
    temp=s.substring(t+10,t+12).toInt();
    humidity1=humidity1+temp;
    t=-1;
    }
    humidity1=humidity1/tc;
    
    for(int i=0;i<8;i++)
    {
      t=json.indexOf("dt_txt");
    String s=json.substring(0,t+31);
    json=json.substring(t+31,json.length());
    t=-1;
    t=s.indexOf("temp_min");
    int temp=s.substring(t+10,t+12).toInt();
    if(tempMin2>temp)
    tempMin2=temp;
    t=-1;
    t=s.indexOf("temp_max");
    temp=s.substring(t+10,t+12).toInt();
    if(tempMax2<temp)
    tempMax2=temp;
    t=-1;
    t=s.indexOf("humidity");
    temp=s.substring(t+10,t+12).toInt();
    humidity2=humidity2+temp;
    t=-1;
      }
      humidity2=humidity2/8;
      
      for(int i=0;i<8;i++)
    {
      t=json.indexOf("dt_txt");
    String s=json.substring(0,t+31);
    json=json.substring(t+31,json.length());
    t=-1;
    t=s.indexOf("temp_min");
    int temp=s.substring(t+10,t+12).toInt();
    if(tempMin3>temp)
    tempMin3=temp;
    t=-1;
    t=s.indexOf("temp_max");
    temp=s.substring(t+10,t+12).toInt();
    if(tempMax3<temp)
    tempMax3=temp;
    t=-1;
    t=s.indexOf("humidity");
    temp=s.substring(t+10,t+12).toInt();
    humidity3=humidity3+temp;
    t=-1;
      }
      humidity3=humidity3/8;

      for(int i=0;i<8;i++)
    {
      t=json.indexOf("dt_txt");
    String s=json.substring(0,t+31);
    json=json.substring(t+31,json.length());
    t=-1;
    t=s.indexOf("temp_min");
    int temp=s.substring(t+10,t+12).toInt();
    if(tempMin4>temp)
    tempMin4=temp;
    t=-1;
    t=s.indexOf("temp_max");
    temp=s.substring(t+10,t+12).toInt();
    if(tempMax4<temp)
    tempMax4=temp;
    t=-1;
    t=s.indexOf("humidity");
    temp=s.substring(t+10,t+12).toInt();
    humidity4=humidity4+temp;
    t=-1;
      }
      humidity4=humidity4/8;

     
     json="";
     Serial.println(date1);
     Serial.println();
     //screen3();
     Serial.print("Today ");Serial.print("Min Temp - ");Serial.print(tempMin1);Serial.println(" Max Temp - ");Serial.print(tempMax1);Serial.println(" Humidity - ");Serial.println(humidity1);
     Serial.print("Tomorrow ");Serial.print("Min Temp - ");Serial.print(tempMin2);Serial.print(" Max Temp - ");Serial.print(tempMax2);Serial.print(" Humidity - ");Serial.println(humidity2);
     Serial.print("Day After Tomorrow ");Serial.print("Min Temp - ");Serial.print(tempMin3);Serial.print(" Max Temp - ");Serial.print(tempMax3);Serial.print(" Humidity - ");Serial.println(humidity3);
     Serial.print("Today + 3 ");Serial.print("Min Temp - ");Serial.print(tempMin4);Serial.print(" Max Temp - ");Serial.print(tempMax4);Serial.print(" Humidity - ");Serial.println(humidity4);
     
   
  }


    String httpGETRequest(const char* serverName) {
  HTTPClient http; 
  http.begin(serverName);
  
  int httpResponseCode = http.GET();
  
  String payload = "{}"; 
  
  if (httpResponseCode>0) {
    Serial.print("HTTP Response code: ");
    Serial.println(httpResponseCode);
    payload = http.getString();
  }
  else {
    Serial.print("Error code: ");
    Serial.println(httpResponseCode);
  }
  http.end();

  return payload;
}

void screen1()
{
        tft.fillScreen(ST7735_BLACK);
  //layout
    tft.drawFastHLine(0, 0, tft.width(), ST7735_WHITE);
    tft.drawFastHLine(1, 159, tft.width(), ST7735_WHITE);
    tft.drawFastVLine(0, 0, tft.height(), ST7735_WHITE);
    tft.drawFastVLine(127, 0, tft.height(), ST7735_WHITE);
    tft.drawFastHLine(1, 140, tft.width(), ST7735_WHITE);
    tft.drawFastHLine(1, 19, tft.width(), ST7735_WHITE);
      tft.setFont();
      tft.setTextColor(ST7735_WHITE);
      tft.setCursor(10,7);
      tft.print(OPEN_WEATHER_MAP_LOCATION);
      tft.setCursor(110,7);
      tft.print(country);
      tft.fillRect(3, 142 , 123, 16, ST7735_BLACK);
      tft.setCursor(10,146);
      if(getH<10)
      tft.print(0);
      tft.print(getH);
      tft.print(":");
      if(getM<10)
      tft.print(0);
      tft.print(getM);
      tft.setCursor(60,146);
      tft.print(date);
      tft.fillRect(3, 22 , 123, 116, ST7735_BLACK);
      tft.setFont(&FreeSansBold18pt7b);
      //tft.setTextColor(ST7735_WHITE);
      tft.setTextSize(1);
      tft.setCursor(22,60);
      tft.setTextColor(colors[2]);
      if(getH<10)
      tft.print(0);
      tft.print(getH);
      tft.print(":");
      if(getM<10)
      tft.print(0);
      tft.print(getM);
      tft.setFont(&FreeSans9pt7b);
      int daylen=0;
      daylen=dayName.length();
      if(daylen==6)
      tft.setCursor(35,90);
      else if (daylen==7)
      tft.setCursor(27,90);
      else if (daylen==8)
      tft.setCursor(21,90);
      else if (daylen==9)
      tft.setCursor(15,90);
      tft.setTextColor(colors[getD]);
      tft.print(dayName);
      tft.setTextColor(ST7735_WHITE);
      tft.setCursor(19,120);
      tft.print(date);
  }

  void screen2()
  {
    tft.fillRect(3, 22 , 123, 116, ST7735_BLACK);
    //tft.drawBitmap(8, 25, clouds, 51, 38,ST7735_WHITE);
    displayweatherbitmap_screen2();
  tft.setFont(&FreeSansBold9pt7b);
  tft.setTextColor(ST7735_WHITE);
  //tft.setTextColor(ST7735_WHITE);
      tft.setTextSize(1);
      tft.setCursor(2,80);
      tft.setTextColor(col);
      tft.print(main);
      tft.setCursor(64,50);
//      int range = map(tempF, 0, 60, 0, 6);
//      tft.setTextColor(colors[range]);
       if(tempF<=0)
       {
        tft.setTextColor(0x07FF);
        }
        else if(tempF>0 && tempF<5)
       {
        tft.setTextColor(0x03DF);
        }
        else if(tempF>6 && tempF<16)
       {
        tft.setTextColor(0x87E0);
        }
        else if(tempF>16 && tempF<27)
       {
        tft.setTextColor(0xFC00);
        }
        else if(tempF>27 && tempF<37)
       {
        tft.setTextColor(0xFA20);
        }
        else
       {
        tft.setTextColor(0xF800);
        }
      tft.print(tempF);
      tft.setFont();
      tft.setCursor(87,35);
      tft.print("C");
      
      tft.setTextColor(ST7735_WHITE);
      if(humidity<10)
      {
        tft.setTextColor(0x04E0);
        }
        else if(humidity<20 && humidity>10)
      {
        tft.setTextColor(0x87E0);
        }
        else if(humidity<30 && humidity>20)
      {
        tft.setTextColor(0xFFE0);
        }
        else if(humidity<40 && humidity>30)
      {
        tft.setTextColor(0xFB20);
        }
        else if(humidity>40)
      {
        tft.setTextColor(0xF800);
        }
      tft.setFont(&FreeSansBold9pt7b);
      tft.setCursor(94,50);
      tft.print(humidity);
      tft.setFont();
      tft.setCursor(118,35);
      tft.print("%");
      tft.setCursor(4,85);
      tft.setTextColor(col);
      String s=desc;
      String s1="";
      String s2="";
      if(s.length()>20)
      {
      char c[s.length()];
      s.toCharArray(c,s.length());
      for(int i=20;i>0;i--)
      {
        if(c[i]==' ')
        {
          s1=s.substring(0,i+1);
          int j=20-i;
          for(int k=0;k<j;k++)
          {
            s1=s1+" ";
            }
          s2=s.substring(i+1,s.length());
          break;
          }
        }
        s2=" "+s2;
        tft.print(s1+s2);
      }
      else
      {
        tft.print(s);
        }
      tft.setCursor(8,110);
      tft.setTextColor(0x87F0);
      tft.print("Pressure  WindSpeed");
      tft.setCursor(11,122);
      tft.print(pres);
      tft.print(" hpa");
      tft.setCursor(75,122);
      tft.print(wind);
      tft.print(" m/s");
      tft.setTextColor(ST7735_WHITE);
    }

    void screen3()
    {
      int day2=getD+1;
      if(day2>6)
      day2=day2-7;
      int day3=day2+1;
      if(day3>6)
      day3=day3-7;
      int day4=day3+1;
      if(day4>6)
      day4=day4-7;
      tft.fillRect(2, 22 , 124, 116, ST7735_BLACK);
      tft.drawBitmap(8, 28, weather1, 39, 24,colors[day2]);
    tft.drawBitmap(8, 68, weather1, 39, 24,colors[day3]);
    tft.drawBitmap(8, 108, weather1, 39, 24,colors[day4]);
      tft.setFont();
      tft.setTextColor(colors[day2]);
    tft.setCursor(65,25);
    tft.print(daysOfTheWeek[day2]);
    tft.setCursor(97,38);
    tft.print("C");
    tft.setCursor(105,44);
    tft.print(humidity2);
    tft.print("%");
    tft.setFont(&FreeSansBold9pt7b);
    tft.setCursor(50,50);
    tft.print(tempMin2);
    tft.print("/");
    tft.print(tempMax2);
    tft.setFont();
    tft.setTextColor(colors[day3]);
    tft.setCursor(65,65);
    tft.print(daysOfTheWeek[day3]);
    tft.setCursor(97,78);
    tft.print("C");
    tft.setCursor(105,84);
    tft.print(humidity3);
    tft.print("%");
    tft.setFont(&FreeSansBold9pt7b);
    tft.setCursor(50,90);
    tft.print(tempMin3);
    tft.print("/");
    tft.print(tempMax3);
    tft.setFont();
    tft.setTextColor(colors[day4]);
    tft.setCursor(65,105);
    tft.print(daysOfTheWeek[day4]);
    tft.setCursor(97,118);
    tft.print("C");
    tft.setCursor(105,124);
    tft.print(humidity4);
    tft.print("%");
    tft.setFont(&FreeSansBold9pt7b);
    tft.setCursor(50,130);
    tft.print(tempMin4);
    tft.print("/");
    tft.print(tempMax4);
      }

      void displayweatherbitmap_screen2()
      {
        if(main.equals("Clouds"))
        {
          col=0xFFE0;
          tft.drawBitmap(8, 25, clouds, 51, 38,0xFFE0);
          }
          else if(main.equals("Rain"))
        {
          col=0x07FF;
          tft.drawBitmap(8, 25, rain, 51, 40,0x07FF);
          }
          else if(main.equals("Thunderstorm"))
        {
          col=0x03DF;
          tft.drawBitmap(8, 25, thunder, 51, 40,0x03DF);
          }
          else if(main.equals("Clear"))
        {
          col=0xFFE0;
          tft.drawBitmap(8, 25, clearS1, 37, 40,0xFFE0);
          }
          else if(main.equals("Drizzle"))
        {
          col=0x07FF;
          tft.drawBitmap(8, 25, drizzle, 51, 40,0x07FF);
          }
          else if(main.equals("Snow"))
        {
          col=ST7735_WHITE;
          tft.drawBitmap(8, 25, snow, 51, 40,ST7735_WHITE);
          }
          else
        {
          col=0xD6D5;
          tft.drawBitmap(8, 25, mist, 51, 40,0xD6D5);
          }
        }

can you help me???

Just use the first code

I needed to put the wifi manager because i need my device to adapt with other wifi or other home

How many free memory and free heap? Why not use jpg or bmp in littlefs?

Look at the Bodmer OpenWeather lib.
screenshot_15570

Made with Bodmer TFT_eSPI, OpenWeather and JSON_Decoder.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.