SunFounder Thales Kit for Raspberry Pi Pico, Release 1.0
Wiring
1. Connect VCC of LCD to VBUS of Pico.
2. Connect the GND of LCD to the GND of Pico.
3. Connect SDA of LCD to GP0 of Pico, which is I2C0 SDA.
4. Connect SCL of LCD to GP1 of Pico, which is I2C0 SCL.
Code
The following is the library of lcd1602 packaged by Sunfounder.
You need to save it in Pico, name it
lcd1602.py
and use it as a library.
import
machine
import
time
class
LCD
():
def
__init__
(
self
, addr
=
0x27
, blen
=
1
):
sda
=
machine
.
Pin(
0
)
scl
=
machine
.
Pin(
1
)
self
.
bus
=
machine
.
I2C(
0
,sda
=
sda, scl
=
scl, freq
=
400000
)
#print(self.bus.scan())
self
.
addr
=
addr
self
.
blen
=
blen
self
.
send_command(
0x33
)
# Must initialize to 8-line mode at first
time
.
sleep(
0.005
)
self
.
send_command(
0x32
)
# Then initialize to 4-line mode
time
.
sleep(
0.005
)
self
.
send_command(
0x28
)
# 2 Lines & 5*7 dots
time
.
sleep(
0.005
)
self
.
send_command(
0x0C
)
# Enable display without cursor
time
.
sleep(
0.005
)
self
.
send_command(
0x01
)
# Clear Screen
(continues on next page)
102
Chapter 3. For MicroPython User
Summary of Contents for Thales Kit
Page 1: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 Jimmy SunFounder Jun 04 2021 ...
Page 2: ......
Page 4: ...ii ...
Page 6: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 2 CONTENTS ...
Page 140: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 136 Chapter 3 For MicroPython User ...
Page 164: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 160 Chapter 4 For Arduino User ...