i am note sure if the library you used supports DHt21. Try this code:-
#include <DHT.h>
#define DHTPIN D4 // Digital pin connected to the DHT sensor
#define DHTTYPE DHT21 // DHT 21 (AM2301)
DHT dht(DHTPIN, DHTTYPE); // Initialize DHT sensor.
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
float temp = dht.readTemperature();
float hum = dht.readHumidity();
Serial.println(temp);
Serial.println(hum);
}