接线方式:
:---PCF85741---: :---RASP---:
GND-------------06 GROUND
VCC-------------02 5V
SDA-------------03 SDA1
scl--------scl1(参考作者没有指明,所以走了很多弯路)
打开/etc/modules ,在文件结尾加上 i2c-dev、i2c-bcm2708
pi@raspberrypi ~ $ sudo nano /etc/modules
写入保存
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
snd-bcm2835
i2c-bcm2708
i2c-dev
————————————————
安装 i2c-tools工具与python-smbus
pi@raspberrypi ~ $ sudo apt-getinstall i2c-toolspython-smbus
记得开启i2c 命令
sudo raspi-config
寻址:
pi@raspberrypi~$ sudo i2cdetect -y1
如果出现不显示下图 27 可查看地四根线是否都接入scl1
测试库
安装测试程序
git clone https://github.com/dhylands/python_lcd.gitcdpython_lcd
sudo pip install -e.
运行测试文件
sudo lcd/i2c_lcd_test.py (此处有坑)直接运行会报错
修改python_lcd/lcd/lcd_api.py最有一个方法
如下图
放上成功图留作纪念
部分内容参考 https://blog.csdn.net/cong408/article/details/60587189
记录我踩过的坑,希望对后来人有所帮助。