##############################################################
# 16x2 I2C LCD Interface (Serial Connection) #
##############################################################
#
# Interfacing 16x2 I2C LCD display with Raspberry Pi Pico / W / 2 / w2 (Hardware & Simulation)
#
# Check out the link for Code explanation and Hardware details
# Link:
# http://tech.arunkumarn.in/blogs/raspberry-pi-pico/interfacing-16x2-I2C-lcd-display-with-raspberry-pi-pico-and-micropython/
#
#
from machine import Pin, SoftI2C
from pico_i2c_lcd import I2cLcd
from time import sleep
# LCD I2C address and dimensions
I2C_ADDR = 0x27
I2C_NUM_ROWS = 2
I2C_NUM_COLS = 16
# Initialize I2C
i2c = SoftI2C(sda=Pin(8), scl=Pin(9), freq=400000)
# Initialize 16x2 LCD
lcd = I2cLcd(i2c, I2C_ADDR, I2C_NUM_ROWS, I2C_NUM_COLS)
sleep(0.25)
# Clear the LCD
lcd.clear()
# By default, it will start at (0,0) if the display is empty
lcd.putstr(" Welcome to ")
sleep(1)
# Starting at the second line (0, 1)
lcd.move_to(0, 1)
lcd.putstr(" Aavishkarah ")
sleep(4)
# turn off baklight
lcd.backlight_off()
lcd.display_off()