跳到主要内容

搭配 树莓派 使用

硬件连接​

连接树莓派的时候,可以直接将板子插到树莓派的 40PIN 排针上去,注意对好引脚。

树莓派连接引脚对应关系

e-PaperRaspberry PiRaspberry Pi
BCM2835编码Board物理引脚序号
VCC3.3V3.3V
GNDGNDGND
SDASDA.13
SCLSCL.15
RST47
BUSY1711

1

开启I2C接口​

  • 打开树莓派终端,输入以下指令进入配置界面

    sudo raspi-config
    选择Interfacing Options -> I2C -> Yes 开启I2C接口

RPI open i2c

然后重启树莓派:

sudo reboot

运行C语言例程​

  • 安装 lg 库

    #打开树莓派终端,并运行以下指令:
    wget https://github.com/joan2937/lg/archive/master.zip
    unzip master.zip
    cd lg-master
    make
    sudo make install
    # 更多的可以参考源码:https://github.com/gpiozero/lg
  • 安装 BCM2835(可选)

    #打开树莓派终端,并运行以下指令:
    wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz
    tar zxvf bcm2835-1.71.tar.gz
    cd bcm2835-1.71/
    sudo ./configure && sudo make && sudo make check && sudo make install
    # 更多的可以参考官网:http://www.airspayce.com/mikem/bcm2835/
  • 下载程序(已下载可跳过这一步)

    wget https://www.waveshare.net/w/upload/f/f6/E-Paper-Segment-Code.zip
    unzip E-Paper-Segment-Code.zip -d E-Paper-Segment-Code
    cd e-Paper/RaspberryPi/
  • 备用解压方式

    sudo apt-get install p7zip-full
    7z x E-Paper-Segment-Code.zip -O./E-Paper-Segment-Code
    cd e-Paper/RaspberryPi/
  • 编译程序(说明:-j4 为使用4线程编译,数字可自行修改)

    # 此时在 e-Paper/RaspberryPi 位置
    cd c
    sudo make clean
    sudo make -j4
  • 运行程序

    sudo ./main

运行python例程​

  • 安装函数库

    sudo apt-get update
    sudo apt-get install python3-pip
    sudo apt-get install python3-pil
    sudo apt-get install python3-numpy
    sudo apt-get install python3-smbus
  • 安装函数库(python2)

    sudo apt-get update
    sudo apt-get install python-pip
    sudo apt-get install python-pil
    sudo apt-get install python-numpy
    sudo apt-get install python-smbus
  • 下载程序(已下载可跳过这一步)

    wget https://www.waveshare.net/w/upload/f/f6/E-Paper-Segment-Code.zip
    unzip E-Paper-Segment-Code.zip -d E-Paper-Segment-Code
    cd e-Paper/RaspberryPi/
  • 备用解压方式

    sudo apt-get install p7zip-full
    7z x E-Paper-Segment-Code.zip -O./E-Paper-Segment-Code
    cd e-Paper/RaspberryPi/
  • 运行程序

    # 确保在 e-Paper/RaspberryPi/ 位置
    cd python/1in9_E-paper
    sudo python3 main.py