from machine import Pin,ADC
from gpio_lcd import GpioLcd
import time
lcd = GpioLcd(rs_pin=Pin(16),
enable_pin=Pin(17),
d4_pin=Pin(18),
d5_pin=Pin(19),
d6_pin=Pin(20),
d7_pin=Pin(21),
num_lines=2,
num_columns=16
)
v = ADC(Pin(28))
while 1:
value = v.read_u16()
volt = value * (5 / 65535)
lcd.clear()
lcd.move_to(0, 0)
lcd.putstr("ADC: " + str(value))
lcd.move_to(0, 1)
lcd.putstr("Volt: " + str(round(volt, 2)) + "V")
time.sleep(1)