Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8041

MicroPython • Pico i2c LCD1602 Example in GET STARTED WITH MICROPYTHON ON Pico Book

$
0
0
I am trying to get the example on page 118 to work. It's a Pico connected to a generic 1602 LCD with an I2C backpack. I get an address from scanning (0x27) but no text is displayed, despite adjusting the contrast. Any ideas?

I'd love to be able to use this display without a 3rd-party library. Thonny/PyPI doesn't have a library for this.

import machine
SDA=machine.Pin(0)
SCL=machine.Pin(1)
i2c=machine.I2C(0,sda=SDA,scl=SCL, freq=400000)
I2C_ADDR = i2c.scan()[0]
print("I2C address of the LCD is:", hex(I2C_ADDR))
#
i2c.writeto(I2C_ADDR, '\x7C')
i2c.writeto(I2C_ADDR, '\x2D')
i2c.writeto(I2C_ADDR, "Hello Nick.")

Statistics: Posted by pettefar — Tue Aug 19, 2025 3:03 pm



Viewing all articles
Browse latest Browse all 8041

Trending Articles