from machine import Pin, I2C, ADC
import ssd1306
from time import sleep
pot = ADC(Pin(13))
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:
x = pot.read()
x=map(pot.read(), 0, 4095, 0,5)
oled.text("Read voltage", 0, 0)
oled.text("$%.2f V" %(x), 10, 10)
oled.show()
sleep(0.1)
oled.fill(0)
Loading
ssd1306
ssd1306