0

I'm trying to get an LCD display (1602 via I2C from pi pico W) to work, and my code is as follows:

import busio
import time
from adafruit_character_lcd import character_lcd_i2c

i2c = busio.I2C(board.GP15, board.GP14)

lcd = character_lcd_i2c.Character_LCD_I2C(i2c, 16, 2, address=0x3f)

lcd.clear()
lcd.home()
lcd.backlight = True
lcd.message = "Hello, World!"
time.sleep(2)

But when I run it, the screen flashes on for a second and doesn't show any text before shutting off. The I2C interface works after i manually set the address so I have no idea why its not working. Any Ideas?

Joshua
  • 56
  • 1
  • 4

1 Answers1

0

There are different controllers for the I2C bus out there. The adafruit library is developed for the MCP23008, that is the chip they sell themselves. It has a default address of 0x20. Other chips use different default addresses.

Since you had to change the address to 0x3f I assume that you have a different chip. In my adapter there is a PCF8574 with a default address of 0x27. As stated in https://lastminuteengineers.com/i2c-lcd-arduino-tutorial/ there are different manufacturers for the PCF8574, there is one from NXP that has a default address of 0x3f. So chances are good that you have one of those.

So you need a different library to communicate with your display. For the PCF8574 I found this on Github: https://github.com/mrkaleArduinoLib/LiquidCrystal_I2C .

Peter I.
  • 101
  • 6
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 10 '23 at 12:50