print("Hello, ESP32!")
from machine import Pin,PWM,ADC,SoftI2C
from time import sleep_ms
from i2c_lcd import I2cLcd
i2c = SoftI2C(sda = Pin(13),scl = Pin(14),freq = 100000)
print(i2c.scan())
#i2c address
address = (i2c.scan()[0])
print(address)
lcd = I2cLcd(i2c,address,2,16)
lcd.putstr("Hello world!")
led = PWM(Pin(12,Pin.OUT),freq = 1000)
adc = ADC(Pin(26),atten = ADC.ATTN_11DB)
while True:
led.duty_u16(adc.read_u16())
# print(adc.read_u16())
lcd.move_to(0,1)
lcd.putstr("value:")
lcd.move_to(7,1)
lcd.putstr(str(adc.read_u16()))
# print(str(adc.read_u16()))
# sleep_ms(10)