#include <Wire.h>          
#include <Adafruit_GFX.h>  
#include <Adafruit_SSD1306.h>  
#include "DHTesp.h"


#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64 
Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

int sensorPin= 2;

DHTesp sensor;


void setup() {

  sensor.setup( sensorPin, DHTesp::DHT22);
  Serial.begin(115200);
  
  oled.begin(SSD1306_SWITCHCAPVCC,0x3c);
  
  oled.clearDisplay ();
  
  oled.setTextSize (3);
 
  oled.setTextColor (WHITE);
 
  oled.setCursor (0,2);
  
  oled.display ();
  delay(500);

 }

 void loop() {
  oled.clearDisplay ();
  
  TempAndHumidity data = sensor.getTempAndHumidity ();
 
  oled.setTextSize (2);
  oled.setTextColor(WHITE);
  
  oled.setCursor (0,2);

  // Convert Celsius to kelvin
  float kelvin = (data.temperature + 273);
 
  oled.println("TEMP "+String(kelvin,1)+"K");
   oled.setCursor (0,36);
  
  oled.println("HUM "+String(data.humidity,1)+"%");
 
  oled.display ();
  delay(1200);
  oled.clearDisplay ();
 }
$abcdeabcde151015202530fghijfghij