import time,random,math
from machine import I2C,SoftI2C,Pin,RTC
from pico_i2c_lcd import I2cLcd
i2c=SoftI2C(sda=Pin(0),scl=Pin(1),freq=400000)
lcd_addr=i2c.scan()[0]
print(lcd_addr)
lcd=I2cLcd(i2c,lcd_addr,2,16)
ans=[]
for i in range(10):
cnt=0
for i in range(1000):
r=int((random.random()*2))
c=int((random.random()*16))
lcd.clear()
lcd.move_to(c,r)
lcd.putstr("*")
time.sleep(0.05)
lcd.clear()
cnt=cnt+1
if r==1 and c==5:
ans.append(cnt)
print(cnt)
cnt=0
break
print(sum(ans)/len(ans))