I am trying to connect a 1602A LCD display with an I2C adapter. I reduced the sketch to its simplest form : METRO (+5V, GND, SDA, SCL) -> LCD1602A (+5V, GND, SDA, SCL).
I understood that I had to install 10 kOhm Pull-Up resistors, which I did. I coded a very simple program just to validate the operation of the display. But there you have it, only the backlight comes on. So there, I do not really know what to do. To make sure the display works correctly, I tested it on an Arduino UNO with a program written in C and it works!
Here is the program in CircuitPython.
Code: Select all
# coding: utf8
# LCD1602_I2C_test_base_1.py
"""Simple test for 16x2 character lcd connected to an MCP23008 I2C LCD backpack."""
import time
import board
import adafruit_character_lcd.character_lcd_i2c as character_lcd
# Modify this if you have a different sized Character LCD
lcd_columns = 16
lcd_rows = 2
# Initialise I2C bus.
i2c = board.I2C() # uses board.SCL and board.SDA
# Initialise the lcd class
lcd = character_lcd.Character_LCD_I2C(i2c, lcd_columns, lcd_rows, address=0x27)
lcd.backlight = True
# Print a two line message
msg = f"Hello\nCircuitPython"
lcd.message = msg
print(msg)
# Wait 5s
time.sleep(5)
lcd.clear()
msg = f"Initialisation\nLine 2"
print(msg)
while True:
lcd.message = msg
I also did another test program to only test SDA, SCL lines by alternating backlight status with one second interval. The result: the backlight does not turn on for the time that the lcd.backlight value is True, but I can clearly see an alternation between On and Off because the backlight flickers at a very low intensity.
Do you have any suggestions to solve my problem?