模板: E-paper for rpi use 1in9 Segment

来自Waveshare Wiki
跳转至: 导航搜索

Raspberry Pi

硬件连接

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

树莓派连接引脚对应关系
e-Paper Raspberry Pi
BCM2835编码 Board物理引脚序号
VCC 3.3V 3.3V
GND GND GND
SDA SDA.1 3
SCL SCL.1 5
RST 4 7
BUSY 17 11

1.9inch Segment e-Paper Module-树莓派.jpg

开启I2C接口

  • 打开树莓派终端,输入以下指令进入配置界面
sudo raspi-config
选择Interfacing Options -> I2C -> Yes 开启I2C接口

RPI open i2c.png

然后重启树莓派:

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