import dht
from machine import Pin, I2C
import ssd1306
sensor = dht.DHT22(Pin(14))
sensor.measure()
sensor.temperature()
sensor.humidity()
i2c = I2C(sda=Pin(4), scl=Pin(5))
display = ssd1306.SSD1306_I2C(128, 64, i2c)
oled_width = 128
oled_height = 64
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
sensor = dht.DHT22(Pin(15))
while True:
oled.fill(0)
sensor.measure()
temp = sensor.temperature()
hum = sensor.humidity()
oled.text("Temp. {} C".format(temp),5,15)
oled.text("Hum {} % ".format(hum),5,5)
oled.show()
Loading
ssd1306
ssd1306