NODEMCU 4DIGIT TM1637 DHT11

#include <NTPClient.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <TM1637Display.h> //
#include <DHT.h>

#define CLK D2 // Define the connections pins:
#define DIO D3
#define DHTPIN D5 // Pin sensor is connected to

// Create degree Celsius symbol:
const uint8_t celsius[] = {
// SEG_A | SEG_B | SEG_F | SEG_G, // Circle
SEG_G | SEG_E | SEG_D // c
};
const uint8_t hum[] = {
// SEG_A | SEG_B | SEG_F | SEG_G, // Circle
SEG_F | SEG_E | SEG_G | SEG_C // h
};

// Set DHT type, uncomment whatever type you’re using!
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DHTTYPE DHT21 // DHT 21 (AM2301)

float temp_c = 0.0;
float humi = 0.0;
TM1637Display display = TM1637Display(CLK, DIO); // Create display object of type TM1637Display:
DHT dht = DHT(DHTPIN, DHTTYPE);

const char *ssid = “xxxx”;
const char *password = “yyyyyy”;

//const long utcOffsetInSeconds = 19802;
const long utcOffsetInSeconds = 25200;

// Define NTP Client to get time
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, “1.th.pool.ntp.org”, utcOffsetInSeconds);

void setup(){
Serial.begin(9600);
Serial.println();
Serial.println(“DHTxx test!”);
dht.begin();
// Begin serial communication at a baud rate of 9600:

WiFi.begin(ssid, password);

while ( WiFi.status() != WL_CONNECTED ) {
delay ( 500 );
Serial.print ( “.” );
}

timeClient.begin();
}

void loop() {
int A,B;

// Read the temperature as Celsius and Fahrenheit:
temp_c = dht.readTemperature();
humi = dht.readHumidity();

// print both to serial console
Serial.printf(“%2.2fC %2.2f%%\n”, temp_c, humi);

timeClient.update();
display.setBrightness(7); // Set the brightness:

A = timeClient.getHours() * 100 + timeClient.getMinutes();
B = timeClient.getSeconds();

if((B % 2) == 0)
{
display.showNumberDecEx(A, 0b01000000 , false, 4, 0);
}
else
{
display.showNumberDecEx(A, 0b00000000 , false, 4, 0);
}

delay (3000);
display.clear();
display.showNumberDecEx(static_cast<int>(temp_c * 100), 0x40);
display.setSegments(celsius, 1, 3);
delay (30000);
display.clear();
display.showNumberDecEx(static_cast<int>(humi * 100), 0x40);
display.setSegments(hum, 1, 3);
delay (30000);
display.clear();

}