LCD 1602 I2C Display Ke Raspberry Pi Pico
Table of Contents
Persiapan Bahan #
– Raspberry Pi Pico / Pico W
– LCD 1602 With I2C / IIC
– Breadboard
– 4x Kabel Jumper Male to Female
– Kabel Micro USD
– Aplikasi Thonny IDE
Wiring LCD I2C Ke Raspberry Pi Pico #
![](https://khurslabs.com/wp-content/uploads/2023/01/LCD-1602-I2C.png)
– connect the GND of the display to a GND (ground) pin (black cable)
– connect the VCC pin of the display with a 5V pin (red wire)
– connect the SDA pin of the display to GP0 (grey wire)
– connect the SDC pin of the display to GP1 (yellow wire)
Sample Code #
from machine import Pin, I2C
from lcd_api import LcdApi
from pico_i2c_lcd import I2cLcd
I2C_ADDR = 0x27
I2C_NUM_ROWS = 2
I2C_NUM_COLS = 16
i2c = I2C(0, sda=machine.Pin(0), scl=machine.Pin(1), freq=400000)
lcd = I2cLcd(i2c, I2C_ADDR, I2C_NUM_ROWS, I2C_NUM_COLS)
lcd.backlight_on()
lcd.putstr("Great! It Works!")
lcd.move_to(3,1)
lcd.putstr("khurslabs.com")
Hasil yang di tampilkan di Aplikasi Thonny IDE #
![](https://khurslabs.com/wp-content/uploads/2023/01/Hasil-2.png)
Mendeteksi Address I2C #
import machine
sda=machine.Pin(0)
scl=machine.Pin(1)
i2c=machine.I2C(0,sda=sda, scl=scl, freq=400000)
print('I2C address:')
print(i2c.scan(),' (decimal)')
print(hex(i2c.scan()[0]), ' (hex)')