from machine import Pin, SoftI2C, ADC
from pico_i2c_lcd import I2cLcd
from time import sleep
I2C_ADDR = 0x27
I2C_NUM_ROWS = 2
I2C_NUM_COLS = 16
val_adc = ADC(26)
sw = Pin(9, Pin.IN, Pin.PULL_UP)
i2c = SoftI2C(sda=Pin(4), scl=Pin(5), freq=200000)
lcd = I2cLcd(i2c, I2C_ADDR, I2C_NUM_ROWS, I2C_NUM_COLS)
while 1: # косяк:
if ((sw.value())):
lcd.clear()
lcd.putstr(str("shalom"))
if not((sw.value())):
reading_val = val_adc.read_u16()
print(reading_val)
lcd.clear()
lcd.putstr(str(reading_val))
sleep(4)
sleep(0.1)