[Circuit] 开启RASPBERRY PI I2C功能

将/etc/modprobe.d/raspi-blacklist.conf文件中的两项注释掉:

pi@raspberrypi ~ $ sudo nano /etc/modprobe.d/raspi-blacklist.conf
#blacklist spi-bcm2708
#blacklist i2c-bcm2708

在/etc/modules中添加以下几行

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.
i2c-dev
i2c-bcm2708
snd-bcm2835

更新软件列表并安装i2c-tools和python-smbus

pi@raspberrypi ~ $ sudo apt-get update
pi@raspberrypi ~ $ sudo apt-get install i2c-tools python-smbus

打开raspi-config=>Interfacing Options=>I2C

pi@raspberrypi ~ $ sudo raspi-config

重启后用以下命令查看i2c设备(PI B+ "sudo i2cdetect -y 1"; PI A "sudo i2cdetect -y 0")

pi@raspberrypi ~ $ sudo i2cdetect -y 1

树莓派i2c总线使用 及 i2c-tools python-smbus 的安装:https://blog.csdn.net/panwen1111/article/details/81044428

你可能感兴趣的:([Circuit] 开启RASPBERRY PI I2C功能)