from machine import Pin,SoftI2C,Timer,ADC
import time
from math import log
from ssd1306 import SSD1306_I2C
i2c=SoftI2C(sda=Pin(13),scl=Pin(12))
oled=SSD1306_I2C(128,64,i2c,addr=0x3c)
NTC=ADC(Pin(2))
BETA = 3950
while 1:
analogValue = NTC.read()
celsius = 1 / (log(1 / (4095. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15
print('%.2f'%(celsius))
time.sleep(1)
oled.fill(0)
oled.text('&&*%',0,0)
oled.text("ADC",0,15)
oled.text(str('%.2f'%(celsius))+' (4095)',0,35)
oled.show()