import machine
import time
import ssd1306
i2c = machine.I2C(0, sda=machine.Pin(4), scl=machine.Pin(5), freq=400000)
oled = ssd1306.SSD1306_I2C(128, 64, i2c)
sensor_temp = machine.ADC(4)
conversion_factor = 3.3 / 65535
print("Experiment 3.2: I2C OLED Display Starting...")
while True:
reading = sensor_temp.read_u16() * conversion_factor
temperature = 27 - (reading - 0.706) / 0.001721
oled.fill(0)
oled.text("IOT MONITER",20,0)
oled.text()