I'm attempting to get a 16x2 I2C LCD module to work with a RPi Pico using Circuitpython.
I'm using the code found in the article here: https://learn.adafruit.com/i2c-spi-lcd- ... cuitpython with the proper modifications for the Pico
Code: Select all
i2c = busio.I2C(board.GP1, board.GP0)
It runs through the code properly but the only output I get is the occasional flash of the backlight, no text on the display.
I'm finding all sorts of code for Micropython and the Pico, but nothing concrete for using Circuitpython and the Pico.
I've tried running the display at both 3.3v and 5v, and there is no difference.
Any help would be greatly appreciated.
Full code :
Code: Select all
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
"""Simple test for 16x2 character lcd connected to an MCP23008 I2C LCD backpack."""
import time
import board
import busio
import adafruit_character_lcd.character_lcd_i2c as character_lcd
#initialize I2C bus.
i2c = busio.I2C(board.GP1, board.GP0)
# set LCD dimensions
lcd_cols = 16
lcd_rows = 2
lcd_addr = 0x27
#initialize LCD class
lcd = character_lcd.Character_LCD_I2C(i2c, lcd_cols, lcd_rows, lcd_addr)
# Turn backlight on
lcd.backlight = True
# Print a two line message
lcd.message = "Hello\nCircuitPython"
# Wait 5s
time.sleep(5)
lcd.clear()
# Print two line message right to left
lcd.text_direction = lcd.RIGHT_TO_LEFT
lcd.message = "Hello\nCircuitPython"
# Wait 5s
time.sleep(5)
# Return text direction to left to right
lcd.text_direction = lcd.LEFT_TO_RIGHT
# Display cursor
lcd.clear()
lcd.cursor = True
lcd.message = "Cursor! "
# Wait 5s
time.sleep(5)
# Display blinking cursor
lcd.clear()
lcd.blink = True
lcd.message = "Blinky Cursor!"
# Wait 5s
time.sleep(5)
lcd.blink = False
lcd.clear()
# Create message to scroll
scroll_msg = "<-- Scroll"
lcd.message = scroll_msg
# Scroll message to the left
for i in range(len(scroll_msg)):
time.sleep(0.5)
lcd.move_left()
lcd.clear()
lcd.message = "Going to sleep\nCya later!"
time.sleep(5)
# Turn backlight off
lcd.backlight = False
time.sleep(2)