import time
from machine import Pin, I2C, SoftI2C
from pico_i2c_lcd import I2cLcd
import random
buzzer = Pin(0, Pin.OUT)
i2c = SoftI2C(sda=Pin(12), scl=Pin(11), freq=400000)
lcd_address = i2c.scan()[0]
lcd = I2cLcd(i2c, lcd_address, 2, 16)
while True:
cycle = random.randint(2000, 6000)
lcd.move_to(0,0)
lcd.putstr(f"Frequency:- \n{cycle}")
for i in range(1000):
buzzer.toggle()
time.sleep(1/cycle)
time.sleep(1)