跳到主要内容

树莓派和 Pico 使用教程

搭配树莓派使用教程

硬件连接

1.83inch Touch LCD Module树莓派 (BCM)
VCC3.3V
GNDGND
LCD_DINGP10
LCD_CLKGP11
LCD_CSGP8
LCD_DCGP25
LCD_RSTGP27
LCD_BLGP18
TP_SDAGP2
TP_SCLGP3
TP_RSTGP17
TP_INTGP4

示例使用

开启 SPI 跟 I2C 接口

  1. 打开树莓派终端,输入以下指令进入配置界面
    sudo raspi-config
  2. 选择 Interfacing Options -> SPI -> Yes 开启 SPI 接口
  3. 选择 Interfacing Options -> I2C -> Yes 开启 I2C 接口
  4. 请确保 SPI 没有被其他的设备占用,你可以在/boot/config.txt 中间检查

安装库

git clone https://github.com/WiringPi/WiringPi
cd WiringPi
./build
gpio -v
注意

运行 gpio -v 会出现对应版本,如果没有出现说明安装出错

Python

python2
sudo apt-get update
sudo apt-get install python-pip
sudo apt-get install python-pil
sudo apt-get install python-numpy
sudo pip install RPi.GPIO
sudo pip install smbus
sudo pip install spidev
python3
sudo apt-get update
sudo apt-get install python3-pip
sudo apt-get install python3-pil
sudo apt-get install python3-numpy
sudo pip3 install RPi.GPIO
sudo pip3 install smbus
sudo pip3 install spidev

下载测试程序

打开树莓派终端,执行:

sudo apt-get install unzip -y
cd ~
sudo wget https://www.waveshare.net/w/upload/9/9a/1.83inch_Touch_LCD_RPI.zip
sudo unzip ./1.83inch_Touch_LCD_RPI.zip
cd 1.83inch_Touch_LCD_RPI

运行测试程序

注意

以下命令请在 RaspberryPi 下执行,否则不在索引不到目录;

C 语言

cd ~
cd 1.83inch_Touch_LCD_RPI/c
sudo make clean
sudo make -j
sudo ./main

python

cd ~
cd 1.83inch_Touch_LCD_RPI/python/example
sudo python 1inch83_LCD_test.py

运行效果

  • 屏幕正常点亮

搭配树莓派 Pico 使用教程

硬件连接

1.83inch Touch LCD Module树莓派 Pico
VCC3.3V
GNDGND
LCD_DINGP11
LCD_CLKGP10
LCD_CSGP9
LCD_DCGP14
LCD_RSTGP8
LCD_BLGP15
TP_SDAGP6
TP_SCLGP7
TP_RSTGP16
TP_INTGP17

Windows 环境下

  1. 下载示例程序,解压后进入 1.83inch_Touch_LCD_Pico 的文件夹中。
  2. 进入 1.83inch_Touch_LCD_Pico 后,使用 vs code 打开工程
  3. 选择编译器
  4. 开始编译
  5. 编译完成
  6. 将 build 中的 main.uf2 文件拷贝带 Pico 中,就会自动运行程序了

运行效果

  • 屏幕正常点亮