from machine import Pin, ADC, I2C
import ssd1306
i2c = I2C(0, scl=Pin(22), sda=Pin(21))
oled = ssd1306.SSD1306_I2C(128, 64, i2c)
pot = ADC(Pin(34))
pot.atten(ADC.ATTN_11DB)
while True:
oled.fill(0)
valor = pot.read()
largura = int((valor / 4095) * 128)
for x in range(largura):
for y in range(32, 42):
oled.pixel(x, y, 1)
oled.text(f"Valor: {valor}", 0, 0)
oled.show()