import time
from machine import Pin, ADC, PWM, I2C, SoftI2C
from pico_i2c_lcd import I2cLcd
i2c = SoftI2C(sda=Pin(18), scl=Pin(19), freq=400000)
lcd_address = i2c.scan()[0]
lcd = I2cLcd(i2c, lcd_address, 2, 16) #Constructor with 4 parameters
verticle = ADC(26)
horizontal = ADC(27)
select = Pin(0,Pin.IN)
i=0
j=0
lcd.clear()
lcd.move_to(i,j)
lcd.putstr(f"o")
show = ['*','o']
while True:
if verticle.read_u16()<32759:
j=(j+1)%2
if verticle.read_u16()>32759:
j=(j-1)%2
if horizontal.read_u16()<32759:
i=(i+1)%16
if horizontal.read_u16()>32759:
i=(i-1)%16
lcd.clear()
lcd.move_to(i,j)
lcd.putstr(show[select.value()])
time.sleep(0.2)
# while True:
# print(verticle.read_u16())
# time.sleep(0.5)
# print(horizontal.read_u16())
# time.sleep(0.5)
# print(select.value())
# print()
# time.sleep(0.5)