將/etc/modprobe.d/raspi-blacklist.conf文件中的兩項(xiàng)注釋掉:
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設(shè)備(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