from machine import Pin, I2C, ADC
import ssd1306
import time
from math import log
temp_pin= ADC(Pin(27))
temp_pin.attem(ADC.ATTN_11DB)
temp_pin.width(ADC.WIDTH_10BIT)
# ESP32 Pin assignment
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
oled_width = 128
oled_height = 64
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)
while True:
temp = 1 / (log(1 / (1023. / temp_pin.read() - 1)) / 3950 + 1.0 / 298.15) - 273.15
oled.text(f'{temp}', 10,10)
oled.text(f'{HOLA}', 10,10)
oled.show()
time.sleep(1)
oled.fill(0)