#Temperature and Humidity sensor
#DHT22 Module to be used
from machine import Pin
from time import sleep
from dht import DHT22
from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
dht = DHT22(Pin(16))
i2c = I2C(0, sda = Pin(0), scl = Pin(1), freq = 400000)
oled = SSD1306_I2C(128, 64, i2c)
while True:
dht.measure()
temp = str(dht.temperature())
hum = str(dht.humidity())
oled.text(f"TEMP: {temp} °C",10,15)
oled.text(f"HUMIDITY: {hum} %",0,35 )
oled.text("SAKTI", 40, 50)
oled.show()
print(f"Temperature: {temp} °C Humidity: {hum}%")