"""
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Raspberry Pi Pico I2C LCD Display (MicroPython) ┃
┃ ┃
┃ An example of using an I2C LCD display with the ┃
┃ Raspberry Pi Pico. ┃
┃ ┃
┃ Copyright (c) 2023 Anderson Costa ┃
┃ GitHub: github.com/arcostasi ┃
┃ License: MIT ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
"""
import time
import machine
import adafruit_lcd
# Define the I2C address of the LCD display
I2C_ADDRESS = 0x27
# Initialize the I2C bus
i2c = machine.I2C(1)
# Create a character LCD object
lcd = adafruit_lcd.Character_LCD(i2c, I2C_ADDRESS)
# Clear the display
lcd.clear()
# Write a message to the first line of the display
lcd.write("Hello, world!")
# Move the cursor to the second line of the display
lcd.setCursor(0, 1)
# Write a message to the second line of the display
lcd.write("This is a Raspberry Pi Pico W")
# Wait for 2 seconds
time.sleep(2)
# Clear the display
lcd.clear()