This is a sample code for displaying characters on LCD 2004A device via I2C protocol. This code is based on example code from pico-examples/lcd_1602_i2c and make some changes including:
- Separating the example code into different source files to make it more clear.
- Add
struct lcd_device
so that we can use different I2C pins instead of default one. - Check LCD's I2C address is available before initializing it.
- Fix invalid memory access issues during displaying messages.
The reason why I create this repo is there are lots of sample code for LCD 1602 or 2004 device, but few of them describe how the sample code works. I will try to add some information to help user to understand the process of sample code.
- pico SDK
- CMake
- Setup
PICO_SDK_PATH
environment variable
export PICO_SDK_PATH=~/pico/pico-sdk
- Create a
build
folder
mkdir build && cd build
- In build directory, run CMake to configure the project
# or cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake ..
- Build an executable file
make