from machine import I2C, Pin
from time import sleep
from i2c_lcd import I2cLcd
#from esp8266_i2c_lcd import I2cLcd # Wokwi's built-in I2C LCD library
# I2C setup
i2c = I2C(0, scl=Pin(36), sda=Pin(21)) # GPIO 22 for SCL, GPIO 21 for SDA
# I2C address and LCD dimensions
LCD_I2C_ADDRESS = 0x27 # Default I2C address for Wokwi
lcd = I2cLcd(i2c, LCD_I2C_ADDRESS, 4, 20) # 20x4 LCD
# Clear the LCD
lcd.clear()
# Display text on each line
lcd.putstr("Line 1: Hello ESP32!")
lcd.move_to(0, 1) # Move to the second line
lcd.putstr("Line 2: 20x4 LCD Test")
lcd.move_to(0, 2) # Move to the third line
lcd.putstr("Line 3: Wokwi Works!") # Corrected text for ESP32
lcd.move_to(0, 3) # Move to the fourth line
lcd.putstr("Line 4:Enjoy Coding!")
# Main loop to keep the program running
#while True:
# sleep(10) # Keep running to show output on the LCD