# LCD
import machine
from machine import Pin, SoftI2C
from lcd_api import LcdApi
from i2c_lcd import I2cLcd
from time import sleep
# I2C setup for general use
sda_pin = Pin(21) # for ESP32
scl_pin = Pin(22)
i2c_general = SoftI2C(scl=scl_pin, sda=sda_pin, freq=10000)
# I2C setup specifically for the LCD display
I2C_ADDR = 0x27
total_rows = 2
total_columns = 16
i2c_lcd = SoftI2C(scl=Pin(22), sda=Pin(21), freq=10000)
# Initialize the LCD object
lcd = I2cLcd(i2c_lcd, I2C_ADDR, total_rows, total_columns)
# Clear the LCD
lcd.clear()
# Display some text
lcd.putstr("Hello,")
lcd.move_to(0, 1) # Move to the second row
lcd.putstr("MicroPython!")
# Wait for a few seconds
sleep(3)
# Clear the LCD again
lcd.clear()